status of 'lazy' ?

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Fri Feb 16 21:09:32 PST 2007


kris wrote:
> David Medlock wrote:
>> kris wrote:
>>
>>> So yeah, with the talk about 'lazy' being /adjusted/ ... how will it 
>>> change? Will the syntax remain as is, or what?
>>>
>>> Thx
>>
>>
>> Why does it need adjustment?
>>
>> I was just getting used to it...
>>
>> -David
> 
> 
> Seems like Andrei made some fairly scathing remarks about it, a while 
> back? IIRC, there was some implication somewhere that it would change?
> 
> Also, how do you propogate/proxy a lazy arg? Looking at the generated 
> code, it seems the proxy itself becomes lazy too ... that seems like a bug?
> 
> I'm asking because there's a good use-case requiring attention ...

Lazy is pretty messy. All qualifiers are pretty messy to define properly 
(within the constraints of their existing semantics and a few other 
essential requirements, e.g. "I don't want to see three 'const's in an 
expression and spend a minute figuring what each means"), and their 
combinations increase messiness, well, combinatorily. Just tell me 
quickly what "const inout lazy const char[]" means...

I don't have time to get busy with it just now, but here's a warmup 
question: what should, and what shouldn't pass the semantic check below?

void Fun(T, U)(T t, U u)
{
   t = 0;
   ++t;
   u[0] = 'a';
   u = "blah";
}

void main()
{
   const int x = 0;
   const char[] y = "wyda";
   Fun(x, y);
   x = 1;
   y[0] = 'a';
   y = "geeba";
}


Andrei



More information about the Digitalmars-d mailing list