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
Local "open", or open locally
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-08-01 (01:47)
From: Lukasz Stafiniak <lukstafi@g...>
Subject: Local "open", or open locally
Dear list,

What about a construct for opening modules locally in an expression? For example

module SomeModule = struct let x = 5 end
module SomeOtherModule = struct let y = 7 end

let z = open SomeModule and SomeOtherModule in x + y + x*y

It can currently be expressed as:

let z = module XY = struct open SomeModule open SomeOtherModule
  let z = x + y + x*y end in XY.z

Perhaps it could be considered as a language extension. It seems nice
as it "catches the focus". (I'm going to use it with Camlp4 but it
seems uglier that way.)

I wouldn't buy it for my kidney, though. ;)

Best Regards,
Lukasz Stafiniak