Pseudo namespaces
ZombineDev via Digitalmars-d
digitalmars-d at puremagic.com
Thu Dec 3 14:32:34 PST 2015
On Thursday, 3 December 2015 at 22:14:56 UTC, Jonathan M Davis
wrote:
> On Thursday, 3 December 2015 at 21:29:51 UTC, Andrei
> Alexandrescu wrote:
>> On 12/03/2015 04:05 PM, FreeSlave wrote:
>>> [...]
>>
>> How would one use a struct for the List example? There's no
>> access to "this". Yes, it's a named scope.
>
> You declare static functions on a struct or class and then make
> the struct or class unusable as an object (e.g. by having a
> final abstract class or explicitly disabling all ways to
> construct the struct or class). There are at least a couple of
> places in Phobos that do that already (e.g.
> std.windows.registry.Registry and std.datetime.Clock both use
> final classes with an @disabled default constructor).
>
> - Jonathan M Davis
Why would you need to resort to such hackery, when Andrei's
solution is much more cleaner?
More information about the Digitalmars-d
mailing list