[OT] Lifetime elision proposal in Rust (& regex macro)

Brian Rogoff via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 30 10:47:10 PDT 2014


On Monday, 30 June 2014 at 17:28:06 UTC, Ary Borenszweig wrote:
> On 6/30/14, 1:50 PM, Nick Treleaven wrote:
>> Hi,
>> This recent proposal looks like it might clean up typical Rust 
>> function
>
> What are those 'a all over the place? I never understood them 
> :-(

Those are lifetimes, which are a part of the Rust type annotation 
machinery. The syntax is borrowed (pun intended ;-) from ML 
family languages, which use type variables like 'a, 'b, 'c 
(pronounced "alpha", "beta", "gamma", or "tick a", tick b", "tick 
c") to express parametric polymorphism.

Rather than try to explain Rust's lifetimes, I'll point you here

http://rustbyexample.com/lifetime.html

Rust is still undergoing development, and the lifetime syntax is 
a bit noisy, so it may change, but the rustbyexample page has 
been following the Rust nightly builds closely. It's an 
interesting language, and the Mozilla backing really helps it, 
but I find D and Nimrod easier to use right now.


More information about the Digitalmars-d mailing list