On Wednesday, 5 February 2014 at 15:56:44 UTC, Dicebot wrote:
On Wednesday, 5 February 2014 at 00:47:27 UTC, Walter Bright wrote:
On 2/4/2014 2:39 PM, Dicebot wrote:
Also non-nullable types should be implicitly cast to nullable parameters so you
don't always need to support all cases distinctively.

The difficulty comes when needing to transfer the nullability of the argument to the nullability of the return type. Implicit conversions don't help with that.

See inout.

Why can't inout be used for that as well? Same for pure & co.

In my opinion "inout" should be simply generic placeholder saying "allow only code that works for all possible qualifiers and preserve those in return type".

But nature of nullable is such that you rarely want to transfer it. Is can be useful as return type sometimes but when you pass it around and process it you almost always want it to be non-nullable. There is no practical benefit in trying to provide all-allowing API's.

If null becomes an invalid value for object references and pointers, then we can use it to unambiguously mean "item does not exist", and it becomes Just Another Value, so it is useful to transfer in various circumstances.

Reply via email to