Day 4 of #rust training and we got onto "lifetimes" which is where the language tries to out compete #cplusplus for ugly syntax. I think this is an effort to persuade you not to write code that needs it.

Follow

@stsquad very little I’ve written has required explicit lifetimes, but in the cases it has ‘static is almost always the only sensible one anyway.

@ajmartinez there was a nice example today with a database iterator wrapper holding a lifetime annotation to some phantom data linked to the parent database.

@stsquad indeed shared data has been the one time I needed to explicitly declare a lifetime. Someone somewhere wrote an excellent piece that demystified them a good deal. I’ll try to find it, though perhaps it’s not as mystifying to real developers. I’m just a guy who sometimes solves problems with software.

Sign in to participate in the conversation
Librem Social

Librem Social is an opt-in public network. Messages are shared under Creative Commons BY-SA 4.0 license terms. Policy.

Stay safe. Please abide by our code of conduct.

(Source code)

image/svg+xml Librem Chat image/svg+xml