: instead of let

It would be super beginners-friendly.

:x = ..
fn..( :a:i8, :b:str ..
for ( :i=0; ..
|:c:i8| ..

What is objections, except "It is too late"?

Or, why, do not we use let ? :

let x = ..
fn..( let a:i8, let b:str ..
for ( let i=0; i<10 ; ..
|let c:i8| ..
...

I disagree, it would be different than most (if not every) other languages, and would be inconsistent with other uses of :

Why should we require more symbols that are not needed?

8 Likes

That's the only objection that's needed: https://github.com/rust-lang/lang-team/blob/master/src/frequently-requested-changes.md#fundamental-changes-to-rust-syntax

If you change the question to "would this be a good idea in a new language", I also think no.

One minor problem with Rust's syntax is that : is used for things that aren't types. It would be much nicer -- for errors, for highlighting, for consistency, etc -- if the only thing that ever happened after a : was a type. (Not a path, not value in a struct initializer, not a binding in a struct pattern, etc.) The path thing -- and the associated typo-ability between std::i32 the path and std:i32 the ascription -- is what killed type ascription in expressions, for example.

Adding even more inconsistent uses of : doesn't make things better.

11 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.