On 11-12-20 02:55 PM, Elly Jones wrote:

2. The dot after the nullary tag. In general I want to write a nullary tag a LOT
more often than I want to write a wildcard binder, so I feel like this is the
wrong way for this choice to go, but I'll understand if this is a decided issue
already.

Agreed. There's a wiki page showing options on this.

3. The use of alt in situations which would be handled with a guard clause in C.
For example, in C, I might write:
...
let bar(mybar) = foo else { fail "OOPS"; }

This is called a "refutable pattern" in some languages and .. I'd be somewhat-ok with adding it as a way to do a let-destructuring in general, w/o an else clause. Just treat it as an implicit fail (reporting location) the way we do a fallthrough in an alt.

Hermes did something interesting here, which is that a variant type defined typestate predicates along the lines of "value x is variant y", so you could check one and make it a typestate precondition. I'm not sure that's any less syntactically awkward though.

4. I wish a lot more of the standard library was object-oriented. I realize this
is somewhat of a slippery slope, but writing 'vec::len(thing)' is less nice (to
me) than thing.len(). I think that things in the standard library that are
object-like (vec, str, ...) should be objects.

Typeclasses will probably give us a hammer to hit a lot of this stuff with.

5. I do not like the mk_foo()/obj foo {} idiom; it forces code another tabstop
to the right.

And this.

6. Having to export all the members of a tag you're exporting seems bizarre;
when would you ever want the tag but not its members?

When you want a nominal type that you want to Greatly Discourage clients from trying to construct or inspect themselves.

I think we can probably do something with globbing here though. I don't mind making "export tagname::*" mean "export all the constructors". It's a special case in the export-glob logic but not a particularly strange-looking one.

-Graydon
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to