On Thursday, 3 December 2015 at 21:29:51 UTC, Andrei Alexandrescu
wrote:
On 12/03/2015 04:05 PM, FreeSlave wrote:
I don't understand how it is namespace (it's just named scope
for me)
and why do we need template for that? Probably struct with
static
members would work the same without need for instantiating the
template.
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