www.digitalmars.com         C & C++   DMDScript  
Archives

D Programming
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger
D.gnu
D

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics


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