This could be done in the runtime/phobos - is(typeof()) is standard D, so something like:<div><br></div><div>enum supportsTraits = is(typeof(__traits(compiles, {})));</div><div><br></div><div>Could be used.</div><div><br></div>

<div>On another note, dmd, gdc and ldc all use DMDFE, and all support the __ keywords mentioned. SDC will also support them... They're so ubiquitous in D code currently they can't *not* be supported.<br><br><div class="gmail_quote">

On 29 December 2011 11:56, Alex <span dir="ltr"><<a href="mailto:xtzgzorex@gmail.com">xtzgzorex@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi,<br>
<br>
DMD currently has two keywords (AFAIK) starting with double<br>
underscore: __traits and __gshared, and additionally, __ctfe (though<br>
it isn't really a keyword)<br>
<br>
>From what I can understand, they are implementation-dependent, and<br>
thus not necessarily available in all compilers. This is reasonable<br>
enough, but presently, there is no universal way to detect whether the<br>
keywords are available. That means that any code that uses them simply<br>
relies on the compiler having them, period. I don't think this is<br>
optimal, nor is it good language design IMHO.<br>
<br>
I think we need to have version identifiers that indicate whether they<br>
are available, e.g.:<br>
<br>
version (__traits)<br>
{<br>
    enum compiles = __traits(compiles, { ... });<br>
}<br>
else<br>
{<br>
    // Fall back to some other mechanism, perhaps some feature<br>
provided by a non-DMD compiler...<br>
}<br>
<br>
Thoughts on this?<br>
<br>
Regards,<br>
<span class="HOEnZb"><font color="#888888">Alex<br>
_______________________________________________<br>
dmd-internals mailing list<br>
<a href="mailto:dmd-internals@puremagic.com">dmd-internals@puremagic.com</a><br>
<a href="http://lists.puremagic.com/mailman/listinfo/dmd-internals" target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-internals</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Robert<br><a href="http://octarineparrot.com/">http://octarineparrot.com/</a><br>
</div>