Smart pointers instead of GC?

Walter Bright newshound2 at digitalmars.com
Tue Feb 4 14:30:40 PST 2014


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.



More information about the Digitalmars-d mailing list