DIP61: Add namespaces to D

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 27 02:08:46 PDT 2014


27-Apr-2014 13:04, Andrej Mitrovic via Digitalmars-d пишет:
> On 4/27/14, Walter Bright via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
>> On 4/27/2014 1:16 AM, Andrej Mitrovic via Digitalmars-d wrote:
>>> There's a need for scoping symbols other than in modules,
>>
>> What is that need?
>
> Here's some examples from Phobos:
>
> std.uni.unicode is a lowercase-named struct because it's supposed to
> be used as a namespace:
>
> -----
> auto ascii = unicode.ASCII;
> -----

Technically it's a functor that works like this:

auto ascii = unicode("ASCII");

Then opDispatch is just a nice bonus to go with it, and struct is the 
only shop to offer such goodies.



-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list