Preferences

A lifetime keyword would actually go a long way in improving ergonomics. You could even make it synonymous with '. Then people can choose. Maybe one will get much more traction and the other can be deprecated.

The only calls to change the lifetime syntax have been coming from "outside the house". Rust developers are fine using the ' as the lifetime sigil and there are no calls from within the Rust community to change it. Adding a keyword would increase the verbosity substantially.
When is someone a Rust developer and why do you assume that I am not one?

edit: -4 points on my parent comment for a totally valid opinion, not violating any commenting guide line (please enlighten me). However, for the down voters: "Please don't use Hacker News for political or ideological battle. That tramples curiosity."

I don't think that you violated any guidelines. I think that the downvotes for your parent comment are only an expression of disagreement with what you propose. If I can suggest, don't take it personally.

Turning `'` into `lifetime` would make Rust code that needs explicit lifetimes extremely verbose. That would make code harder to keep on the same line, for no added benefit in expressiveness.

Allowing both `'` and `lifetime` in the syntax would make the language more confusing to anyone who is learning it, and it opens up unproductive debates about syntax in code bases if two authors have conflicting preferences.

Your explanation is appreciated. I naively assumed HN moderation was more meta than that. It boils down to taste, ultimately. I'm really a fan of Rust, and it is sobering to now experience this gatekeeping that the Rust community is often accused of first hand.

Of course, mixing keywords single quotes is confusing, but currently the single quote is also confusing.

Just to illustrate: The keyword could just be called lif, which has the same length as dyn.

why?

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

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.

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.

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

enum foo; blah ...;

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.
like parenthesis for functions, tuples and for denoting prioritized evaluation?

This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal