I see two main benefits of rusts borrowed pointers and lifetimes: The first is the safe mechanism for mutable stack-variable-capture via borrowed/non-escaping pointers to blocks.... however this is just about non-escape and stack-scopes, not Rust lifetimes.
The second is their lifetime mechanism for non-GC tracked return values. -- The second could have implications for GC tracked regions, as the explicit lifetime tracking after a borrowed pointer return could enable efficiently returning pointers for elements within GC-tracked regions. (much like "d" below).. -- To provide some CLR related examples... If the CLR were extended with borrowed pointers and lifetimes, I believe: (a) it could have mutable stack capture for borrowed functional blocks (but not for C# async!) (b) it could have more efficient and straightforward multi-paramater iterators, based on borrowed functional blocks instead of iterator element structures (but not for C# async!) (c) through (a), it could admit a cleaner form of property-set-for-structures (d) it could allow lifetime based ref return values, offering C-like performance for access to value-types within type-instantiated collection (e) through (d) it could allow properties to return refs-of-structures The items in that list which I'd be most excited about would be (a,b,c,d), though if it merely got us (d,e) I would be excited about it.
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
