On Saturday, 9 September 2017 at 16:53:19 UTC, jmh530 wrote:
On Saturday, 9 September 2017 at 16:30:51 UTC, Jean-Louis Leroy
wrote:
Also, is it possible to conditionally compile depending on the
compiler's version, not only the compiler (I mean, not compile
a block if it's GDC version 5.4.1 or lower)?
What you really need is a version statement based on the
version of the D language, not the version of DMD or LDC or GDC
per se.
Something like
version(DLANGSEMVER >= 2.076.0)
{
//include static foreach code.
}
but we can't do conditionals in version blocks, so you'd need a
static if. Alternately, we'd also need a trait or something to
get the semver of the compiler.
For some of my needs (like here
https://github.com/jll63/openmethods.d/blob/v1.0.0-rc.2/source/openmethods.d#L1509) 'static if' would work. But I'd really like to provide a template mixin alternative to the string mixin I use in openmethods ('mixin(registerMethods)'). Hmmm...Generally speaking, the lack of [your suggestion] will slow down the adoption of new cool features like 'static foreach'.