System programming in D (Was: The God Language)

Jacob Carlborg doob at me.com
Wed Jan 4 23:24:00 PST 2012


On 2012-01-05 00:21, bearophile wrote:
> Walter:
>
>> The only reason to use classes in D is for polymorphic behavior - and that means
>> virtual functions.
>
> I don't agree, in some cases I use final class instances instead of heap-allocated structs even when I don't need polymorphic behaviour just to avoid pointer syntax (there is also a bit higher probability of destructors being called, compared to heap-allocated structs).
> In some cases I've used a final class just to be able to use a this() with no arguments :-)
>
> Bye,
> bearophile

You can get that with a static opCall for structs too.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list