Difference between "can call" and "can compile"

Jackel jackel894_394 at gmail.com
Wed Sep 16 00:20:24 UTC 2020

On Tuesday, 15 September 2020 at 19:12:04 UTC, Steven 
Schveighoffer wrote:
> I could probably switch to using "hasMember" in this use case, 
> which is likely to be correct for all purposes that I have. 
> It's just not applicable to a public library, which might use 
> things other than members.
> -Steve

You mentioned UFCS, but if it is a template in a library then 
user defined UFCS shouldn't work. The only valid case I can think 
of would be for a built in array, using front() and friends. But 
the library would have to import those functions for it to work.

I do agree with what you are saying, in fact it almost seems like 
__traits(compiles) is a code smell. There's usually a better way 
to express it, and as is with the case you are talking about, a 
different feature would be more appropriate and provide better 
error messages.

More information about the Digitalmars-d mailing list