Possible Lazy Keyword? (Re: Array comprehensions and the like)

Era Scarecrow rtcvb32 at yahoo.com
Sun Jul 20 23:46:22 PDT 2008


Stewart Gordon Wrote:

> 
> "Era Scarecrow" <rtcvb32 at yahoo.com> wrote in message 
> news:mailman.31.1216481994.32098.digitalmars-d at puremagic.com...
> <snip>
> > I do have a serious question then, why note have inserted code that
> > can be run at compile-time in order to build the static data?
> > Assume the following.
> 
> D already has something called compile-time function evaluation, which I 
> beleve can achieve things like this.
> http://www.digitalmars.com/d/1.0/function.html#interpretation
> 
> > bool []primes = {0,0,1,1,0,1,0,1/*. etc. etc.*/} //0-7 primes, 1 is true
> >
> > however i have a code that already gives me this information but i
> > merely need it to be present elsewhere.  If the 'lazy' keyword was
> > introduced, Would it not be nifty if i could let the compiler do it
> > for me?
> <snip>
> 
> D already has a 'lazy' keyword.
> http://www.digitalmars.com/d/1.0/lazy-evaluation.html
> 
> But its semantics are nothing like what I can make of what you're 
> describing.

 Very interesting. I'm currently still learning D, but some of the things being added are so nice :)

 That merely means the keyword 'lazy' is used; I kinda knew lazy wouldn't be the keyword used, if implemented. Perhaps something like CompileTime? 

 However, the question still arises, can we embed a function (or call a function already made) to do the work for us? (For security reasons i'd say it would probably have to be something quickly and easily compiled (perhaps D Scripted?), but would not be able to do any weird memory accesses, or file IO)

 Era



More information about the Digitalmars-d mailing list