Lazy template arguments?

comco void.unsigned at gmail.com
Sun Jan 13 03:47:15 PST 2013


On Sunday, 13 January 2013 at 11:26:57 UTC, monarch_dodra wrote:
> Bearophile: Is this proposal a pure optimization trick, or is 
> there some functionality gains here. The only one I can think 
> of, is if "Foo!B" would fail to compile. Is this what you are 
> going for...?
>
> Also:
> //----
> template Ternary(bool b, T1, lazy T2) {
> //----
> While is only T2 lazy?

That was my point - and I thought that the arguments are 
evaluated lazily. Now, _if_ such support is added, why should we 
be able to pick the evaluation strategy - just make all the 
template arguments lazy by default - the behaviour won't change 
up for the most constructs, but it will be more expressive, 
because you'll be able to pass non-compiling arguments.


More information about the Digitalmars-d-learn mailing list