enum template shorthand and short circuit evaluation

Byron Heads via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 10 09:27:06 PDT 2014


On Tue, 10 Jun 2014 17:06:08 +0200, Artur Skawina via Digitalmars-d-learn
wrote:

> On 06/10/14 02:28, Byron via Digitalmars-d-learn wrote:
>> Should this work?  It seems like the short circuit booleans are not
>> working:
>> 
>> enum isPrimitive(T) = isBasicType!T || (isArray!T && isBasicType!
>> (ForeachType!T));
> 
> 
> No. Allowing invalid code just because it will be skipped when the code
> executes (either at RT or CT) would create other problems, while only
> solving a minor and relatively rare one (the verbosity of static-if).
> 
> artur
> 
> [1] and a few other contexts, like in template constraints,
> is-expressions etc.


Still feels like a bug to me (ie turtles all the way down is not being 
applied here)



More information about the Digitalmars-d-learn mailing list