top | item 41399244

(no title)

kitkat_new | 1 year ago

why?

It makes type information unnecessarily longer without adding information, and feels like writing "end_stm" instead of ";" after every line

discuss

order

mrweasel|1 year ago

That's the trade off isn't it. ' is unnecessarily short and doesn't convey any information at all, or worse, the wrong information. There are other comments that point out that ' is valid in identifier, or used to indicate that something is derived from something else.

Some will prefer the short nature of just typing ', where people like me would prefer that you just add a few more characters so it reads more easily.

kitkat_new|1 year ago

It is, but not a trade off many would make.

' itself (!) may not convey information, but it's existence does convey information.

While making it a keyword may help beginners to understand code and wish they could see the meaning directly, because they don't know the meaning of certain symbols yet, people who know the language and productively produce code are more concerned about content rather than syntax.

Content meaning the name of the life time, the name of the types, the name parameters, the structure of the types, the constraints on the types, etc.

Especially for Rust, there is a lot of the things mentioned above, and since the concepts in Rust aren't easy, it's important that these things get as much space as possible from the limited space on the screen, instead of wasting it by self explaining syntax elements, which are trivial to memorize.

Thus { instead of begin_function_body, *; instead of statement_end, ? instead of 'if err != nil then return err' and ' instead of lifetime.

Brian_K_White|1 year ago

It's more like if a ; was allowed somewhere else and had a different meaning there.

enum foo; blah ...;

dwattttt|1 year ago

Perhaps a better example would be & referring to AND operations (logical and bitwise), but also being a unary operator for taking the address of a variable.

kitkat_new|1 year ago

like parenthesis for functions, tuples and for denoting prioritized evaluation?