Smart pointers instead of GC?

Michel Fortin michel.fortin at michelf.ca
Mon Feb 3 03:45:18 PST 2014


On 2014-02-03 04:06:00 +0000, Walter Bright <newshound2 at digitalmars.com> said:

> For starters, grep through the source code for all the implicit 
> conversions. Then think about how it fits in with match levels, 
> function overloading, template overloading, partial ordering, ?:, 
> covariance, contravariance, name mangling, TypeInfo, default 
> initialization, will general functions have to be written twice (once 
> for T, again for T?), auto function returns, and that's just off the 
> top of my head.
> 
> It's not just writing a truth table and throwing it over the wall.

But wouldn't that prevent all function arguments from being null at 
all? As well as function return values? That'll make it almost 
impossible to port existing code to this new D model, or interface with 
existing C functions.

It'd still be possible, because you could always use a struct to pass a 
@nullable pointer around, but then that struct will not work with 
partial ordering, ?:, covariance, and contravariance, making things 
quite annoying (just like Rebindable is for tail const/immutable 
classes).

As for writing functions twice, I don't see it. T is implicitly 
convertible to T?, so a single function with a T? parameter will work 
with both T and T? arguments.

-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca



More information about the Digitalmars-d mailing list