caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Local "open", or open locally
@ 2005-08-01  1:47 Lukasz Stafiniak
  2005-08-01  8:42 ` [Caml-list] " Richard Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Stafiniak @ 2005-08-01  1:47 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Local "open", or open locally
  2005-08-01  1:47 Local "open", or open locally Lukasz Stafiniak
@ 2005-08-01  8:42 ` Richard Jones
  2005-08-01 23:35   ` Lukasz Stafiniak
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Jones @ 2005-08-01  8:42 UTC (permalink / raw)
  To: Lukasz Stafiniak; +Cc: caml-list

On Mon, Aug 01, 2005 at 03:47:43AM +0200, Lukasz Stafiniak wrote:
> let z = open SomeModule and SomeOtherModule in x + y + x*y

Yes, I too would really like this syntax in the core language, as well
as local type and exception definitions.

There is a camlp4 extension for local open, called openin:

http://www.eleves.ens.fr/home/frisch/soft.html#openin

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Local "open", or open locally
  2005-08-01  8:42 ` [Caml-list] " Richard Jones
@ 2005-08-01 23:35   ` Lukasz Stafiniak
  0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Stafiniak @ 2005-08-01 23:35 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list

> There is a camlp4 extension for local open, called openin:
> 
> http://www.eleves.ens.fr/home/frisch/soft.html#openin
> 
Thanks. I've extended it with lists of modules, and reworked tuareg.el
quickly (but to make it simpler I removed "open" from phrase
delimiters). It works fine :)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-08-01 23:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-01  1:47 Local "open", or open locally Lukasz Stafiniak
2005-08-01  8:42 ` [Caml-list] " Richard Jones
2005-08-01 23:35   ` Lukasz Stafiniak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).