I wish all qualifiers were revisited with an eye for simplification

Nick Treleaven nick at geany.org
Tue Aug 25 15:33:02 UTC 2020

On Monday, 17 August 2020 at 11:23:04 UTC, Andrei Alexandrescu 
> On 8/14/20 9:35 PM, Timon Gehr wrote:
>> There is this persistent myth that __traits(compiles, ...) is 
>> the same as is(typeof(...)) this is not the case and IIRC I 
>> have used it to demonstrate that most template constraints in 
>> Phobos don't work correctly.
> This is a problem as __traits should be a lower-level, 
> seldom-used resort.

__traits(compiles) is not really a trait. Whether an expression 
is valid or not isn't really metadata of the expression - because 
in e.g. D, an expression must be valid in order to have metadata. 
Traits can be wrapped by templates, this can't. Besides these 
points, it would be nicer syntax to have something like 
__compiles(expr) instead.

More information about the Digitalmars-d mailing list