www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Ranges

grauzone Wrote:

 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(" "); }))

Kind of like the oomigooli bird. Flies round in ever decreasing circles and eventually disappears up its own arsehole.
Jun 19 2009