Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Pierre Weis <Pierre.Weis@inria.fr>
To: laffitte@didac-mip.fr
Cc: caml-list@inria.fr
Subject: Re: problemes de types
Date: Tue, 22 Jul 1997 09:29:44 +0200 (MET DST)	[thread overview]
Message-ID: <199707220729.JAA09686@pauillac.inria.fr> (raw)
In-Reply-To: <199707211449.QAA02229@yeti2.didac-mip.fr> from Jean-Claude Laffitte at "Jul 21, 97 04:49:03 pm"

> j'ai un petit probleme avec les definitions de types. Lorsque je definis deux 
> types enregistrements ayant un champ portant le meme nom, le compilateur 
> semble avoir du mal a reconnaitre les types de mes variables.
[...]
> Le meme type de conflit existe avec les types enumeres.

Effectivement, il n'y a pas de surcharge sur les identificateurs en
Caml. C'est vrai pour les noms de champs d'enregistrement, les
constructeurs de types somme, les identificateurs de valeurs et les
ope'rateurs (pas de surcharge de + par exemple). Seuls les objets
d'O'Caml permettent cette surcharge sur les me'thodes.

Si vous voulez de'finir des champs de me^me nom dans plusieurs types
diffe'rents, il faut les de'finir dans des modules diffe'rents,
puisque chaque module introduit son propre espace de nom.

> **********************************************************************
> English summary
> **********************************************************************
> I've a little problem with record types. When I define two types with a common 
> field name, the compiler seems to have problems to recognize the type of 
> variables.
[...]
> The same problems appears with variant types.

There is no overloading in Caml, neither for field names in records,
constructors names in concrete types nor for functions or operators
names (e.g. +). However, objects in O'Caml provide overloading for
methods names. 

A solution to overcome the problem is to define the types in separate
modules, since each module introduce a new space name.

Best regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/







      reply	other threads:[~1997-07-22  7:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-21 14:49 Jean-Claude Laffitte
1997-07-22  7:29 ` Pierre Weis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199707220729.JAA09686@pauillac.inria.fr \
    --to=pierre.weis@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=laffitte@didac-mip.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox