Old problem with performance

Weed resume755 at mail.ru
Mon Feb 9 05:32:58 PST 2009


Michel Fortin пишет:
> On 2009-02-09 07:00:56 -0500, Weed <resume755 at mail.ru> said:
> 
>>> No. By forbiding the cases that leads to slicing, like returning a
>>> polymorphic object by value.
>>
>> Let's think, can there are other ways to solve problem?
>>
>> Here, for example my reasons:
>> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=81958
>>
> 
> I'm
>>
> not sure I'm getting what you mean in that post.
> 
> It seems like you want the ability to copy classes, and thus pass them
> by value, but only when there would be no type conversion.
> 

Yes, this is the easiest way that came to my head


> I'm not getting where this can be useful though: by forcing your classes
> to be of a specific type, with no derived types allowed, you're losing
> polymorphism.

Yes

> The only advantage you have is that your type can be
> derived from another so you can reuse some of its implementation.

And still able to pass class instance through a stack!

And I do not propose to remove the traditional class in the heap

> There
> are other ways to acheive that in D however (mixins come to mind).
> 



More information about the Digitalmars-d mailing list