Old problem with performance

Rainer Deyke rainerd at eldwood.com
Mon Feb 9 13:07:21 PST 2009


Andrei Alexandrescu wrote:
> So the problem exists since you are trusting the programmer to avoid it.

The slicing problem exists in the sense that it is possible for a bad
programmer to accidentally slice an object.  However:
  - This is not a problem with the language, but an avoidable programmer
error in the language.
  - There are far more common programmer errors in C++ against which D
does not guard.  For example, dangling pointers to stack variables that
have gone out of scope.
  - D's response to this perceived problem is far too heavy-handed,
because it disallows useful correct code.
  - I would even say that the reference type classes in D lead to more
problems.  It is very easy for two objects in D to accidentally share
internal state, something that is impossible with value types.
  - Even if the slicing problem were a major issue in C++, it should be
possible to partially or totally fix it at the language level in D
without sacrificing inheritance for value types.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list