On Friday, 27 November 2015 at 20:14:21 UTC, Andrei Alexandrescu
wrote:
There's this oddity of built-in hash tables: a reference to a
non-empty hash table can be copied and then both references
refer to the same hash table object. However, if the hash table
is null, copying the reference won't track the same object
later on.
I keep hoping that that design decision would be changed...
1. Factory function:
Something I find deeply unsatisfying about D structs is their
inability to reliably set non-trivial invariants, due to the lack
of custom default ctors. If you are careful, you @disable this(),
and provide a factory function that sets the invariant. But then,
you aren't doing much more than renaming this() to make() or
whatever. The issues with .init could be addressed without
prohibiting a default ctor...