Pseudo namespaces

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 3 15:30:15 PST 2015


On Thursday, 3 December 2015 at 22:54:53 UTC, Andrei Alexandrescu 
wrote:
> On 12/03/2015 05:46 PM, Steven Schveighoffer wrote:
>> On 12/3/15 3:51 PM, Andrei Alexandrescu wrote:
>>> I vaguely remembered I saw something like this a while ago:
>>>
>>> http://dpaste.dzfl.pl/f11894a098c6
>>>
>>> The trick could be more fluent, but it might have merit. Has 
>>> anyone
>>> explored it? Is it a viable candidate for becoming a D idiom?
>>
>> I'm going to take a step back and ask, what's wrong with 
>> stableFun?
>
> Nothing. But one thing I was keeping an eye for would be to 
> allow lst.stable.linear.xxx and lst.linear.stable.xxx with one 
> body. -- Andrei

That seems like it would be confusing, since it's non-obvious 
that those two things would be the same thing, though there also 
isn't an obvious hierarchy between linear and stable. AFAIK, 
they're orthogonal, so it's not obvious which would go inside the 
other. However, it also doesn't seem very user friendly to have 
that much extra stuff involved in what is essentially the 
function name. Whether it's using pseudo-namespaces or is just 
one long name, linearStableXXX / linear.stable.xxx and 
stableLinearXXX / stable.linear.xxx are both rather unwieldy, 
though I confess that I prefer not having the periods. It's 
shorter that way, and you don't have to explain the 
pseudo-namespaces to anyone that way either, since that's not 
exactly a normal idiom. But it would be best IMHO if we could 
find a way to either not need those extra tags on the function 
names or to at least minimze their length.

- Jonathan M Davis


More information about the Digitalmars-d mailing list