English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
RE: Undefined labels
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-11-15 (07:27)
From: Manuel Fahndrich <maf@m...>
Subject: RE: Undefined labels

This is the standard example for why we need a local open in the language.


-----Original Message-----
From: Christian RINDERKNECHT [mailto:rinderkn@hugo.int-evry.fr]
Sent: Friday, November 12, 1999 8:48 AM
To: caml-redistribution@pauillac.inria.fr
Cc: caml-list@inria.fr
Subject: Re: Undefined labels


> 	(Unix.fstat argument).st_kind
> Here, the function returns a structure, st_kind
> is a label of that structure, but it is not known
> in the calling module. Is there a syntax for this?


        (Unix.fstat argument).Unix.st_kind
because the compiler doesn't know in what module to look-up for label

> Using 'open Unix' is unacceptable.

I also never use the "open" feature, but the consequence is, when using
nested records, I must qualify all the labels (as in your example),
and the code becomes unreadable.

I recently started using classes in order to avoid this practical
problem, since methods are in the scope of their object, not of the
module embedding their class.

But this doesn't work if the library you are using is not
object-oriented, of course:)

Best regards,



Christian Rinderknecht                     Phone +33 (0)1 60 76 44 43
Institut National des Télécommunications   Fax   +33 (0)1 60 76 47 11
Département Logiciels Réseaux (LOR)        WWW
9, Rue Charles Fourier, F-91011 Évry Cedex