Ranges

grauzone none at example.net
Thu Jun 18 14:19:04 PDT 2009


Robert Fraser wrote:
> Yeah, that one is a bit tricky, and what makes it worse is that it seems 
> officially sanctioned by Walter/Andrei as the "right way" to check if a 
> type supports some operations. Basically, if you have:

Oh, finally someone who shares my concerns! I fear the alternatives 
would require to much thought and implementation/testing work, so that 
our gurus prefer the current approach, despite that the semantic of the 
code depends on silent compilation failures. (Just like SFINAE, maybe 
even worse.)

> is(typeof({ @@@ }()));
> 
> this means "if I made a function containing @@@, would that function 
> compile?". It's a hack which stems from the way the is expression works.

Your example doesn't compile right now. But if you use a string mixin, 
the code doesn't even have to be syntactically/lexically valid:

is(typeof({ mixin("@@@"); }))




More information about the Digitalmars-d mailing list