* [Caml-list] First class module syntax
@ 2017-05-05 12:28 Andre Nathan
2017-05-05 12:42 ` octachron
0 siblings, 1 reply; 5+ messages in thread
From: Andre Nathan @ 2017-05-05 12:28 UTC (permalink / raw)
To: caml-list
[-- Attachment #1.1: Type: text/plain, Size: 437 bytes --]
Hi
I was thinking about the syntax for a function taking a module as a
parameter, i.e.,
let f (module M : S) = ...
Off the top of my head I couldn't think of anything that would prevent
the syntax from being like
let f (M : S) = ...
I can't think of ways in which this would be ambiguously parsed, so I
was just wondering what led to the choice of requiring the "module"
keyword in this case.
Cheers,
Andre
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] First class module syntax
2017-05-05 12:28 [Caml-list] First class module syntax Andre Nathan
@ 2017-05-05 12:42 ` octachron
2017-05-05 12:54 ` Andre Nathan
0 siblings, 1 reply; 5+ messages in thread
From: octachron @ 2017-05-05 12:42 UTC (permalink / raw)
To: caml-list
As a counter-example, consider:
module type s = sig end (* module type names do not need to start
with a capital *)
type s = M
Then, both
(* f: s → unit *)
let f (M:s) = ()
and
(* g: (module s) → unit *)
let g (module M:s) = ()
are currently valid.
Consequently, allowing "g:(module s)→unit" to be written as
let g (M:s) = ()
would be ambiguous.
— octachron.
Le 05/05/2017 à 14:28, Andre Nathan a écrit :
> Hi
>
> I was thinking about the syntax for a function taking a module as a
> parameter, i.e.,
>
> let f (module M : S) = ...
>
> Off the top of my head I couldn't think of anything that would prevent
> the syntax from being like
>
> let f (M : S) = ...
>
> I can't think of ways in which this would be ambiguously parsed, so I
> was just wondering what led to the choice of requiring the "module"
> keyword in this case.
>
> Cheers,
> Andre
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-06 8:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 12:28 [Caml-list] First class module syntax Andre Nathan
2017-05-05 12:42 ` octachron
2017-05-05 12:54 ` Andre Nathan
2017-05-05 13:08 ` Max Mouratov
2017-05-06 8:00 ` SP
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox