I think `alias get this` is a misfeature.

If at all possible, compiletime errors should be preferred over runtime errors. The point of Nullable is that the value contained within may be absent. Considering the prevalence of type inference and UFCS chaining in idiomatic D, it is very possible that a change to a Nullable type, or a change of a parameter to a non-Nullable type, may not be noticed by the typesystem. In that case, the unhandled null state that could have been caught by the compiler will turn into a runtime exception.

This seems a poor, magical and unexpected choice of behavior.

Is there any strong reason why Nullable!T can implicitly convert to T? If not, I'd argue that `alias get this` should be deprecated, and removed at the earliest convenience. It throws away clear safety for unclear gain.

Reply via email to