Limitations of __traits(compiles, {})
Adam D. Ruppe
destructionator at gmail.com
Thu Jul 23 13:59:39 UTC 2020
On Thursday, 23 July 2020 at 13:33:02 UTC, Per Nordlöw wrote:
> Doesn't __traits(compiles) support syntactic changes to the
> language that hasn't yet been implemented?
The whole codebase must pass the parser before it even considers
what is in there. So new syntax cannot be detected through this
or version or anything else.... unless the code is quoted.
If the code is in quotes - as a string - then the parser doesn't
look at it until it needs to. So you might be able to detect
using mixin.
__traits(compiles, mixin(" your code here"))
More information about the Digitalmars-d
mailing list