D - more or less power than C++?

Walter Bright newshound at digitalmars.com
Fri Mar 3 20:05:10 PST 2006


"xs0" <xs0 at xs0.com> wrote in message news:duatsu$29vu$1 at digitaldaemon.com...
> Walter Bright wrote:
>> "Oskar Linde" <olREM at OVEnada.kth.se> wrote in message 
>> news:duak88$1rmh$1 at digitaldaemon.com...
>>>- Definable assignment/copy semantics for structs.
>>>
>>>This (combined with end of scope destruction) allows automatic reference
>>>counted resource handles, ownership-transferals, and more.
>> True, but the need for these are relatively insignificant in D, since D 
>> has gc and on_scope.
> Hmm, are there any major use cases for assignment/copy semantics for 
> structs, other than smart pointers? If not, the solution may be to support 
> those explicitly, and be done with it?

Once one has gc and on_scope, there simply isn't much left for 
assignment/copy semantics. Not enough to be worth bothering with.

> Having weak references/pointers would be useful in itself (where weak 
> means it does not prevent GC; of course it should be detectable whether 
> the object is still there). Those, GC, auto and added support for 
> something like shared_ptr and auto_ptr would cover most needs, I think?

The on_scope takes care of the need for ***_ptr.

> As for the original question, I think D is way better.

So do I <g>. 





More information about the Digitalmars-d mailing list