On 6/5/11 11:00 PM, Rob Arnold wrote:
I am sad to see anonymous records go since I use them frequently in my ML and JavaScript programs where giving a type a name doesn't make sense (perhaps if there's no type inference at function boundaries this doesn't matter). Tuples obviously make sense in the vector example you gave (which is what I usually point to as a use case for anonymous records) but tuples don't handle the cases where the type changes over time (specifically dropping fields). Also sometimes it's just awkward to give a name to a type; this is one my frustrations with C-like languages.
Oh, I actually think anonymous records are a perfect fit for fully type-inferred languages like ML. I miss SML's anonymous records a lot in OCaml. It's just that in practice, every Rust record gets a name via a typedef, since they spill across function boundaries so often and we have to annotate function signatures.
Your point about dropping fields is interesting; in what kinds of situations have you wanted to drop record fields?
Patrick _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
