[Issue 12892] extern(C): label confined to version scope

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 11 14:03:14 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12892

--- Comment #4 from Mark Isaacson <markisaa at umich.edu> ---
Thanks for the quick reply Walter!

I'm afraid that I'm still confused however; the explanation seems tangential.

I'm aware that the curly braces from the static if are present for grouping
rather than [semantic?] scoping. It is precisely because of this that I would
expect use of extern(C): as a label to transcend the curly braces. Otherwise,
the power to do something like version(X) { extern(C): } seems like nonsense
that should be flagged by a linter at minimum.

I agree that the ability to use static if anywhere seems like a gross expansion
of its current role. Perhaps it is that I have trouble thinking in terms of
grammars, but that seems much more dramatic/drastic of a change than allowing
use of things like extern(C): or immutable: to escape version/static if
grouping. Is there no sensible middle ground?


I suppose that leaves me with another question, which is how might I achieve
the result I'm looking for: to conditionally compile with extern(Windows) or
extern(C) depending on platform for a large number of functions? Is today's
answer to copy paste the version() {} else {} to all of them? To use a
mixin/mixin template and repeat that instead?

--


More information about the Digitalmars-d-bugs mailing list