caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Unimplemented modules as top-level signatures
@ 2010-12-17  9:19 Lauri Alanko
  2010-12-23 15:33 ` [Caml-list] " Lukasz Stafiniak
  0 siblings, 1 reply; 3+ messages in thread
From: Lauri Alanko @ 2010-12-17  9:19 UTC (permalink / raw)
  To: caml-list

A minor annoyance in OCaml is that although you can (and must) put
each top-level module into its own file, there is no corresponding
mechanism for defining module types on their own: you always have to
put a "module type" definition inside another module, which
complicates scoping, and with standard tools adds an extra level of
indentation to the signature definition.

However, with 3.12 there is solution of sorts: write the signature
definition in foo.mli without an accompanying foo.ml, and then refer
to the signature as "module type of Foo".

Is this horrible style? Are there some pitfalls I should be aware of?
Or are there better solutions to my desire to avoid nested scoping?
Top-level functors would also be nice to have... :)


Lauri Alanko
la@iki.fi


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

* Re: [Caml-list] Unimplemented modules as top-level signatures
  2010-12-17  9:19 Unimplemented modules as top-level signatures Lauri Alanko
@ 2010-12-23 15:33 ` Lukasz Stafiniak
  2010-12-23 15:47   ` [Caml-list] " Sylvain Le Gall
  0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Stafiniak @ 2010-12-23 15:33 UTC (permalink / raw)
  To: caml-list

Interesting question. Lack of response on the mailing list means
agreement that this is an OK style?

On Fri, Dec 17, 2010 at 10:19 AM, Lauri Alanko <la@iki.fi> wrote:
> A minor annoyance in OCaml is that although you can (and must) put
> each top-level module into its own file, there is no corresponding
> mechanism for defining module types on their own: you always have to
> put a "module type" definition inside another module, which
> complicates scoping, and with standard tools adds an extra level of
> indentation to the signature definition.
>
> However, with 3.12 there is solution of sorts: write the signature
> definition in foo.mli without an accompanying foo.ml, and then refer
> to the signature as "module type of Foo".
>
> Is this horrible style? Are there some pitfalls I should be aware of?
> Or are there better solutions to my desire to avoid nested scoping?
> Top-level functors would also be nice to have... :)

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

* [Caml-list] Re: Unimplemented modules as top-level signatures
  2010-12-23 15:33 ` [Caml-list] " Lukasz Stafiniak
@ 2010-12-23 15:47   ` Sylvain Le Gall
  0 siblings, 0 replies; 3+ messages in thread
From: Sylvain Le Gall @ 2010-12-23 15:47 UTC (permalink / raw)
  To: caml-list

Hello,

On 23-12-2010, Lukasz Stafiniak <lukstafi@gmail.com> wrote:
> Interesting question. Lack of response on the mailing list means
> agreement that this is an OK style?
>

I don't think so. Right now:
1) 3.12 is not yet used by everyone
2) its new features are still studied (at least by me)
3) style is really a matter of taste
4) it is in the language, so no problem using it

So basically, go on, test it and give us your feedback. I doubt there
are thousand people already using this, so you will define yourself
what is right or wrong...

AFAIC, I think it is great and that you should use it.

> On Fri, Dec 17, 2010 at 10:19 AM, Lauri Alanko <la@iki.fi> wrote:
>> A minor annoyance in OCaml is that although you can (and must) put
>> each top-level module into its own file, there is no corresponding
>> mechanism for defining module types on their own: you always have to
>> put a "module type" definition inside another module, which
>> complicates scoping, and with standard tools adds an extra level of
>> indentation to the signature definition.
>>
>> However, with 3.12 there is solution of sorts: write the signature
>> definition in foo.mli without an accompanying foo.ml, and then refer
>> to the signature as "module type of Foo".
>>
>> Is this horrible style? Are there some pitfalls I should be aware of?
>> Or are there better solutions to my desire to avoid nested scoping?
>> Top-level functors would also be nice to have... :)
>
> -- 
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>

Regards,
Sylvain Le Gall


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

end of thread, other threads:[~2010-12-23 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-17  9:19 Unimplemented modules as top-level signatures Lauri Alanko
2010-12-23 15:33 ` [Caml-list] " Lukasz Stafiniak
2010-12-23 15:47   ` [Caml-list] " Sylvain Le Gall

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).