Zero-cost version-dependent function call at -O0.

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 25 16:02:28 PDT 2017


On Sunday, 25 June 2017 at 22:53:07 UTC, Johan Engelen wrote:
> I meant semantically no call.

In the existing language, I think version (or static if) at the 
usage and definition points both is as good as you're going to 
get.

unless you use a preprocessor lol

But the good news about version is you could use compiler errors 
about missing name to know where it needs to be (unless there's 
another matching overload in scope[!]). So it would be mildly 
verbose to look at in the code, but not really difficult to get 
right (and you could write it with autocomplete, like vim's 
`:abbr foo version(foo) foo`).

> I am now thinking about introducing a noop intrinsic...

That'd be kinda tricky because the arguments would still be 
liable to be evaluated... so the intrinsic would need to cover 
and disable that too and I think you'd be in for a fight to get 
that approved.


More information about the Digitalmars-d-learn mailing list