extern(C++, ns)

Danni Coy via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 25 04:15:18 PST 2016


D generally doesn't allow shadowing of names inside inner scopes.

int x;
for (int i=0; i<max; i++) { int x = i*2-1; }

works in a lot of languages but not D.

int x;
extern (C) int x;

doesn't work.

having

int x;
extern (C++,ns) int x;

work
might be useful but to me seems inconsistent with the rest of D.

Using sub modules to deal with this seems very much more consistent
with the rest of the design of D.



On Sat, Jan 23, 2016 at 3:04 AM, Jacob Carlborg via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 2016-01-21 00:50, David Nadlinger wrote:
>
>> To add a new feature to the language, the
>> onus is on you to provide compelling evidence why it is necessary to
>> have. You need to show that there is a "serious problem" with just using
>> the native D namespacing scheme (modules) for the purpose, not the other
>> way round.
>
>
> Unfortunately that's not how it works with D. If Andrei or Walter have a
> proposal it's up to the community to provide compelling evidence why it
> _should not_ be added. If the community has a proposal it's up to the
> community to provide compelling evidence why is _should_ be added.
>
> --
> /Jacob Carlborg


More information about the Digitalmars-d mailing list