www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [OT] Lifetime elision proposal in Rust (& regex macro)

reply Nick Treleaven <ntrel-public yahoo.co.uk> writes:
Hi,
This recent proposal looks like it might clean up typical Rust function 
signatures significantly:
https://github.com/aturon/rfcs/blob/lifetime-elision/active/0000-lifetime-elision.md

Some discussion here:
http://www.reddit.com/r/rust/comments/298j3y/question_about_lifetime_parameters/ciig6ol

I thought it might be interesting, and perhaps relevant for D (e.g. 
scope or ref returns?).

In older news, Rust has syntax extensions, which are used for 
compile-time regex compilation:
http://doc.rust-lang.org/regex/index.html#the-regex!-macro

These two developments seem to be making Rust a bit more competitive with D.
Jun 30 2014
parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
On 6/30/14, 1:50 PM, Nick Treleaven wrote:
 Hi,
 This recent proposal looks like it might clean up typical Rust function
 signatures significantly:
 https://github.com/aturon/rfcs/blob/lifetime-elision/active/0000-lifetime-elision.md


 Some discussion here:
 http://www.reddit.com/r/rust/comments/298j3y/question_about_lifetime_parameters/ciig6ol


 I thought it might be interesting, and perhaps relevant for D (e.g.
 scope or ref returns?).

 In older news, Rust has syntax extensions, which are used for
 compile-time regex compilation:
 http://doc.rust-lang.org/regex/index.html#the-regex!-macro

 These two developments seem to be making Rust a bit more competitive
 with D.
What are those 'a all over the place? I never understood them :-(
Jun 30 2014
parent reply "Brian Rogoff" <brogoff gmail.com> writes:
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.
Jun 30 2014
parent reply "Elvis Zhou" <elvis.x.zhou gmail.com> writes:
On Monday, 30 June 2014 at 17:47:11 UTC, Brian Rogoff wrote:
 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.
I like this rustbyexample.com, is there a dbyexample.com?
Jul 01 2014
parent "Brian Rogoff" <brogoff gmail.com> writes:
On Tuesday, 1 July 2014 at 15:06:27 UTC, Elvis Zhou wrote:
 I like this rustbyexample.com, is there a dbyexample.com?
Nothing that I know of that's exactly the same, but I'm quite happy with http://ddili.org/ders/d.en/, and I'm anxiously awaiting that last 5% or so being translated. It's author, Ali Cehreli, is a frequent and helpful contributor to this forum. It has lots of examples that you can type in and run, so it should be close enough to rustbyexample. Maybe a "Learn D The Hard Way" a-la Zed Shaw would also be nice.
Jul 01 2014