On 13-07-30 01:03 PM, Andreas Rossberg wrote:
> Ah, actually, this asymmetry, as you call it, is also standard, and quite
> relevant. It's rather Haskell's pun on using the same syntax for tuples and
> their classifier that is an outlier (and arguably a wart). The problem with
> it is that it is essentially a category error: (T,U) is the natural notation
> for a tuple of types, not for the type of a tuple of values. This becomes an
> issue if you consider richer languages: having constructs like lambdas or
> tuples on the type level itself (or even higher universes) is common in
> higher-order type systems. And then you need to be able to express both (T,U)
> and T*U, which are completely different beasts. (ML specifically does use
> type tuples for n-ary type constructors: "(int, string) map" has quite a
> different meaning from "(int * string) list" .)
I'm aware of this but I think Haskell chose right, pushing the onus for
differing syntax onto higher order types. In our case as we're targeting
a C++ audience, we had to put all our type parameters in <T,U,V> form
anyways. Of course _this_ has its own lexical headaches when it comes
to disambiguating against the < operator: we used to use [T,U,V] like
Scala, but user feedback decisively rejected it. My kingdom for a few
extra bracket characters!
Maybe I should be more dictatorial and less democratic when it comes to
such things; I'm a bit of a pushover.
> So overloading the syntax of introduction forms with their classifiers is one
> of these things that looks neat at first but turns out not to scale well (and
> to lead to confusion).
> Of course, the former one is conventionally written "{<field_name> = <pat>}"
> for this reason, and the ones mentioned above. :)
Yes, and this is what Rust did for quite a while, until we got
sufficient user feedback that they preferred ":" here.
Maybe once unicode input methods are sufficiently widespread we won't
have people fighting over ":" _or_ brackets so much :)
-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev