D Beginner Trying Manual Memory Management

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 12 13:54:41 PST 2015


On Mon, 12 Jan 2015 21:37:27 +0000
aldanor via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:

> On Monday, 12 January 2015 at 20:30:45 UTC, ketmar via 
> Digitalmars-d-learn wrote:
> > it even has `RefCounted!`, but it doesn't play well with 
> > classes yet
> > (AFAIR).
> I wonder if it's possible to somehow make a version of refcounted 
> that would work with classes (even if limited/restricted in some 
> certain ways), or is it just technically impossible because of 
> reference semantics?
it's hard. especially hard when you considering inheritance (which is
not playing well with templates) and yes, ref semantics.

on the other side i found myself rarely using classes at all. i mostly
writing templates that checks if a passed "thing" has all the
neccessary methods and properties in place and just using that. with D
metaprogramming abilities (and `alias this` trick ;-) inheritance
becomes not so important. and so classes too. sometimes i'm using
structs with delegate fields to simulate some sort of "virtual methods"
'cause i tend to constantly forgetting about that `class` thingy. ;-)

OOP is overrated. at least c++-like (should i say "simula-like"?)
OOP. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150112/580f1071/attachment.sig>


More information about the Digitalmars-d-learn mailing list