> As far as I know type-after-optional-colon wins on every stated-or-explored
> technical merit (optional inference, destructuring, symmetry with records)
> except two:
>
> - You have to put in an extra character : when you want types,
> maybe not a big deal when people use inference locally all the
> time, but we always annotate fn signatures, so they get chattier.
I don't find the chattiness too much; in fact, I find that
let x : int
reads more instantaneously than
let int x
because the : more quickly divides the roles to my eyes. That's purely
personal, of course.
> - It's not what C, Java, C++, and the rest of that family does.
That's definitely true. It's never clear how far you can stray from C-like
syntax before the tide turns against you. My gut feeling says this won't bother
enough people to be a make-or-break issue, but I have no crystal ball.
> On this point, at least, I'd welcome a straw poll. Just to figure exactly how
> much everyone thinks "most programmers will balk" at "v:T" rather than "T v".
> Look at these examples and decide:
>
> fn push(&T[] v, T e) -> T[] {
> let T[] u = v + [e];
> ret u;
> }
>
> fn push(v: &T[], e: T) : T[] {
> let u: T[] = v + [e];
> ret u;
> }
So yeah, FWIW I prefer the latter.
Dave
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev