A very common pattern in certain kind of applications is like this: The program’s execution is separated into three phrases: In the first phrase we do some global configuration. In the second phrase we run the application logic, many times running an event loop or something. In a minimal third phrase we clean up the global configurations and exit.
It seems natural that people want to store the states their created in the first phrase into some global variables, and access all of them during the second phrase. However, any attempt to do so will quickly see one limitation of Rust: static variables have to be
'static, since there’s no "named global lifetime"s yet in rust.
So the idea is that we can invent some “existential lifetime” concept, make it act as “named global lifetime” and model such usages. The existential lifetime itself will be resolved as a region covering the whole phrase 2 code in
main()(not really sure about the details).
This is just an idea. Not sure whether it’s feasible or the best solution. Just seeking for some comments.