Thanks for all your responses. I’ve had a lot of exams to write, so I apologise for my late response.
[quote=“SiegeLord, post:2, topic:459”]
I really think you should give Rust more than a few hours before complaining about the syntax… many syntactial choices are arbitrary and will end offending someone.[/quote]
Yes, I am new to Rust but think it’s a good idea to display my thoughts from a Rust beginner’s point of view. In my opinion, this is a chance you only get once per person because I will get used to the syntax of Rust as I got used to the syntax of C. However, getting used to something doesn’t mean it’s good.
I think it’s highly questionable whether emulating the C/C++ syntax is a good idea. Is it a good idea to use * for dereferencing and & for an address? Maybe it is, but then Rust has a ref keyword which, in my eyes, clashes with the ampersand. It might be provocative to say that without much knowledge about the actual difference between them, but for me it doesn’t make sense to use a single symbol for one way and a word for the other way. It seems inconsistent.
As sam113101 suggested, it could be a lot clearer by using a keyword called value in a block. I’d prefer that over a semicolon.
[quote=“sam113101, post:7, topic:459”]
I absolutely dislike the fact that python forces indentation.[/quote]
Please explain why you dislike forced indentation. Yes, there are problems with tabs and spaces, but that’s pretty much it as far as I can see.
[quote=“sam113101, post:7, topic:459”]I think we should go with a keyword, like “value” for example:
let a = if (condition) {
expression
expression
expression
value expression // the branch will return this value
}[/quote]
I really like that idea.
[quote=“P1start, post:8, topic:459”]
Not needing semicolons is also very useful in the common constructor function case; e.g., fn make_a_foo() -> Foo { Foo { x: 0, y: 0 } }.[/quote]
But what if we’d use the value keyword only for blocks with multiple statements? I guess, that would be inconsistent…
I don’t want to dismiss the value keyword idea, yet. It needs some more thought, though.
[quote=“P1start, post:8, topic:459”]
And in any case, the semicolon acts as a separator. Replacing that with line breaks would be the first part of Rust’s syntax that was dependent on line breaks (apart from string literals and line comments), or even dependent on whitespace in general (apart from separating identifiers/keywords).[/quote]
As I’ve had the pleasure to do some lexing in the past, I know how painful whitespaces can be. But what would be the problem with line breaks? Of course, coders would have to use them instead of semicolons, which would force them to format properly (no offense to anyone).