Conditional Pure?

%u wfunction at hotmail.com
Sat Jan 22 18:34:52 PST 2011


>> Any ideas on how we might be able to get that to work?
> @optional_tag(is(T == int) || is(T == long)), const)

Ouch... a bit less pretty than I'd hoped (the underscore makes it a bit ugly
IMHO). Does it really need to be a tag, though? Why not just:
   optional(const, is(T == int) || is(T == long))
?


> I and few other people have asked for this, I think there is one closed
enhancement request on this in Bugzilla, but I think Walter closed it on the basis
of uniformity in attribute syntax (and maybe compiler simplicity too).
> Sometimes it's worth breaking uniformity if this avoids some troubles,
especially if all this breakage does is creating some easy-to-fix compile-time
errors. I think this is one of such cases.

Huh... but what's the difference between "static" and "const", that allows "const"
to go after the header but doesn't allow "static" to?


More information about the Digitalmars-d mailing list