On Friday, 9 September 2016 at 12:31:34 UTC, Marco Leise wrote:
The point is that TypeInfo_*.getHash() cannot be @nogc,
because a class or struct may implement a not-@nogc toHash().
(Where I may add, that e.g. TypeInfo_Pointer.getHash() *could*
be @nogc, since all it returns is `cast(size_t)cast(void*)p`).

The alternatives in core.internal.hash are supposed to
be CTFE-able and albeit bytesHash itself does not seem to use
the GC, the wrapper functions for different types may.

And that is why @nogc hash table implementations don't fly at the moment.

Yeah it wouldn't be far-fetched to make toHash() @nogc nothrow.
A hash-table that allocates on lookup would negate any speed-advantage anyway.

Reply via email to