I'm surprised noone has pointed out the new type annotation syntax: let id : type s. s -> s = fun x -> x On Fri, Oct 25, 2013 at 4:32 PM, Yaron Minsky wrote: > Changing the semantics of this will, I think, break a _lot_ of code. > I for one am not excited to do so. > > For what it's worth, I suspect that most people who are surprised by > this are people who were trained on Standard ML. At Jane Street we've > had a lot of people learn the language, and the complaints I've heard > about this feature are, I think, mostly from that group. > > I also don't find Andreas suggestion particularly intuitive. I would > have guessed that (x: '_a) would constrain x to be a weakly > polymorphic value, which is at odds with the proposal. > > y > > On Fri, Oct 25, 2013 at 10:24 AM, Andreas Rossberg > wrote: > > On 10/25/2013 01:09 PM, Gabriel Scherer wrote: > >> > >> However, I think that the current syntax of implicitly-introduced > >> variables with heuristically-defined scoping rules is bad in any case. > >> My own toy experiment with explicit syntaxes always use an explicit > >> binding syntax for both rigid and flexible variables (eg. "forall a b c > >> in ..." and "some a b c in ..."). In this regard, the ('a 'b . ty) or > >> (type a) syntaxes are definite improvements -- if only we had applied > >> those explicit binding forms to GADT constructor types as well... So I > >> think that even with Andreas' proposed change, people would still be > >> surprised by things like the following: > >> > >> let id : 'a -> 'a = fun x -> x > >> > >> let dup (x : 'a) ('a * 'a) = > >> let result = (x, x) in > >> (id : 'a -> 'a) result (* fails, while (id : 'b -> 'b) works *) > > > > > > Yes, I agree that implicit scoping is a bit of an ugly hack. That said, I > > don't expect anybody to be truly surprised about the example above. At > least > > I never heard this being an issue for SML programmers. People probably > > hardly ever write anything like the above, or avoid shadowing for clarity > > anyway. > > > > /Andreas > > > > > > > > -- > > Caml-list mailing list. Subscription management and archives: > > https://sympa.inria.fr/sympa/arc/caml-list > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-bugs > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >