On Friday, 6 July 2018 at 12:10:58 UTC, Simen Kjærås wrote:
The rest looks sensible to me, but I have to say this is bollocks. This Nullable never has to construct an S.init:

struct Nullable(T) {
    ubyte[T.sizeof] _payload;
    bool _hasValue;


Come on, at least make it a union with a void[]. This way will fail with any struct that requires a certain alignment. Not to mention that you can stick a class in it and it'll be garbage collected, because ubyte[] must not store pointers to GC memory.

Which makes the point, really - this is an utterly blatant, unreliable, fragile hack.

Reply via email to