On Tuesday, 4 February 2014 at 22:30:39 UTC, Walter Bright wrote:
On 2/4/2014 4:23 AM, Michel Fortin wrote:
For the rare cases where you actually want both versions to
work,
I think you're making a vast assumption that the case is rare.
When I write utility functions, I want them to work on as wide
a variety of inputs as possible. Otherwise, they are not very
useful.
you can write them twice or use a template (except in a
virtual context), and in both cases
you keep the efficiency of not checking for null when the
argument is not nullable.
That's just what I wish to avoid. Consider adding more pointer
types - the combinatorics quickly explode. Heck, just have two
pointer parameters, and you already have 4 cases.
I wonder how Rust deals with this.
In any case, I have yet to understand why @nullable as a
storage class would be
any better. How do you solve that problem with a storage class?
Good question. I don't have an answer offhand.
rust would use a reference, basically a pointer that can come
from any smart ptr type, and does not outlive its owner