the List example

Leandro Lucarella llucax at gmail.com
Thu Nov 5 16:29:43 PST 2009


Andrei Alexandrescu, el  5 de noviembre a las 10:06 me escribiste:
> Leandro Lucarella wrote:
> >A clear example of this, is not being able to take the address of a local.
> >This is too restrictive to be useful, as you pointed in you post about
> >having to write static methods because of this. If you can't find
> >a workaround for this, I guess safety in D can look a little unrealistic.
> 
> Sorry, I forgot to mention one thing. My example of List in the
> thread "An interesting consequence of safety requirements" used
> struct, but it should be mentioned there's a completely safe
> alternative: just define List as a class and there is no safety
> problem at all. Java, C#, and others define lists as classes and it
> didn't seem to kill them. I agree that using a struct in D would be
> marginally more efficient, but that doesn't mean that if I want
> safety I'm dead in the water. In particular it's great that pointers
> are still usable in SafeD. I'm actually surprised that nobody sees
> how nicely safety fits D, particularly its handling of "ref".

See my other response about efficiency of D when using new/classes a lot.
You just can't do it efficiently in D, ask bearophile for some benchmarks
;)

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Wake from your sleep,
the drying of your tears,
Today we escape, we escape.



More information about the Digitalmars-d mailing list