> My opinion is that we should bring back tuples but that the standard way to > access the elements should be destructuring let.
This seems reasonable to me, except you'd want to allow destructuring tuples anywhere patterns are allowed (e.g., function parameters, alt, etc). > Standard ML does "#1 x". It's even uglier than what rust does since you > probably need to parenthesize it. It's also very rarely used. #n is a > function that can be used in a first class manner, and in my experience it is > essentially only used when it is being passed to a higher-order function. > (For example, "map #1 xs" to build up a list of the first elements of each > tuple in a list of tuples.) When you want to access the elements directly, > you do a let binding. > > I'd be perfectly happy with reintroducing lambdas and not having any way to > access them other than let binding (although this is probably a minority > viewpoint). In my experience, wanting to access tuple elements without let > binding them out is usually a pretty good sign that you should be using a > record instead. (Haskell doesn't provide any way to pull the nth element out > of an arbitrary tuple other than pattern matching, although it does provide > "fst" and "snd" functions in the Prelude that work on pairs.) Again, totally reasonable. And users could always write their own tuple-destructuring functions if they *wanted* to (at least for any given tuple size), but by not providing these in the standard library we'd be telegraphing the message "a record might be preferable here." Dave _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
