It could, but it doesn't yet. This kind of analysis needs porting borrowck to MIR, which still has to happen. It's too complicated given the current way it works.
Though it is a matter of explicit over implicit too. If `name()` had a destructor you may want it to be explicitly tied to a scope by dint of being declared in one instead of floating around in a magical hidden variable that's tied to the scope of a different one. So there are reasons for why it may never be made to work that way.
I'm not sure I see what the problem is with this. It seems like it is very intuitive behaviour in this case and exactly what you would expect.
This is similar to vvanders' and steve's comments in https://news.ycombinator.com/item?id=13413084 ; such things lead to a more complicated mental model even if on the surface it looks simpler.
One problem is that the user would have no way of naming the thing that the lifetime is attached to. Diagnostic messages when trying to hand off 'name' to other code could be perplexing, as the delta between broken code and working code would be larger.
28 | let name = jill.name().first_name();
| ----------- value returned here
28 | let name = jill.name().first_name();
| ^^^^^^^^^^^^^ leaves scope before use,
| and is unavailable hereAlso replacing a O(1) chasing a pointer into a O(n) array search
Edit: To clarify, I am a Rust neophyte and have only begun to scratch the surface of the language.
Edit2: Also, "There is no reason a person should know which class they are in, nor should a class know which people are enrolled in it. "
I know what the author is trying to say but when you read that at face value it comes across as a little humorous.