extern(C++, ns)

Daniel N via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 13 14:22:54 PST 2016


On Tuesday, 12 January 2016 at 05:25:17 UTC, Andrei Alexandrescu 
wrote:
> 1. This code { ... } ought to compile with { these semantics } 
> but does not.

This code...
extern(C++, one) void fun1();
extern(C++, one) void fun2();
... ought to compile.

Considering that all scopes are closed in D, using the current 
semantics the short 'non-scope' version of extern is pointless, 
as one can at most ever bind to 1 symbol per namespace. For this 
reason I suggest to re-purpose it to NOT create a scope. This 
would allow the 'scoped' version of extern to remain as is:

extern(C++, one)
{
}

Not perfect, by any means since ideally both 'extern forms' 
should have identical semantics, but if the current auto-scoping 
feature is here to stay, then they anyway cannot ever be made to 
work with the same semantics(since scopes are closed).

Maybe it's something both camps could live with? At least 
obsoleting tedious workarounds.



More information about the Digitalmars-d mailing list