where type referring to other parameter in functor parameters
Bernard Berthomieu <[email protected]> Fri, 05 Oct 2012 11:30:42 +0200
| Newsgroups | gmane.comp.lang.ml.mlton.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello,
With no structure named A bound at top-level,
mlton accepts the following functor declaration:
signature S = sig type s end;
signature T = sig type t end;
functor Fun1 (structure A : S and B : T where type t = A.s) =
struct val x = 1 end;
Note that the "where type" constraint in the sig of parameter B refers
to parameter A.
I was wondering if such a constraint is legal by "The Definition".
Also, if Fun1 is legal, why is Fun2 below rejected ? I would expect and
to be
commutative here:
functor Fun2 (structure B : T where type t = A.s and A : S) =
struct val x = 1 end;
Polyml rejects Fun1, by the way.
Thanks to the definition experts for any clarification.
Regards,
Bernard.
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev