division of objects into classes and structures is bad
Weed
resume755 at mail.ru
Mon Jan 5 23:15:14 PST 2009
Bill Baxter пишет:
> On Tue, Jan 6, 2009 at 1:41 PM, Christopher Wright <dhasenan at gmail.com> wrote:
>> Weed wrote:
>>> Who agrees with me? There are still ideas as it is possible to solve
>>> this problem and not to destroy language?
>> When you reply to your reply to your reply to your post and nobody else
>> replies to any of your posts, you might start thinking that nobody agrees
>> with you, or cares enough to respond.
>>
>> As to your suggestion that there be compile-time checks for object
>> slicing... well, you'd end up with almost everything with any polymorphism
>> being done by reference for safety. In the remaining situations, scope will
>> usually suffice.
>>
>> I don't think anyone sees sufficient reason to give Walter as much work as
>> you suggest. When would you use this?
>> - In place of the current scope keyword.
>> - For more efficiency with object composition (though scope could be used
>> for this, potentially).
>> - Implementing value semantics with runtime polymorphism.
>>
>> The only interesting thing there is value semantics with polymorphism. If
>> you really care, you can implement polymorphism with structs.
>>
>
> My problem is more that I just can't understand the guy so I don't
> know if I agree with him or not.
>
> I think the choice between just
>
> value semantics / POD / no polymorphism / heap or stack and
> reference semantics / non-POD / polymorphism / heap only
No, for classes I suggest to choose between:
reference semantics / non-POD / polymorphism / heap only (current state)
and
value or reference semantics / non-POD / polymorphism / heap or stack
As a matter of fact how it was in C++, but with check slicing or simply
prohibition of assignment to other types by value. Syntax will demand
attention before change - it is necessary to make so that there was no
mixing of names of references and classes on value.
More information about the Digitalmars-d
mailing list