You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Rust (which vine takes significant syntax inspiration from), the token : is used for two things:
Giving types to things
Initialization of structs
With 10+ years of hindsight, I think we can pretty definitively conclude this is a mistake.
The biggest problem is how this interferes with the type ascription,
so much so that type ascription as a feature was scrapped.
(The a:: Bool is shorthand for a: a: Bool, which is the type-ascripted analogue to the a shorthand for a: a. The :: is somewhat unfortunate, but the alternatives are all worse IMO.)
In Rust (which vine takes significant syntax inspiration from), the token
:
is used for two things:With 10+ years of hindsight, I think we can pretty definitively conclude this is a mistake.
The biggest problem is how this interferes with the type ascription,
so much so that type ascription as a feature was scrapped.
Another point of reference is Carbon, a language that also takes a lot of syntax inspiration from Rust, does not use
:
in struct literals.This allows it to have more natural type ascription, which is especially noticeable for things like tuples.
Rust:
let (x, y): (u8, u32) = (1, 2)
Carbon:
let (x: u8, y: u32) = (1, 2)
The text was updated successfully, but these errors were encountered: