On Tue, 16 Mar 2010 17:37:45 -0400, Steven Schveighoffer <[email protected]> wrote:

On Tue, 16 Mar 2010 17:27:26 -0400, Walter Bright <[email protected]> wrote:

Steven Schveighoffer wrote:
On Tue, 16 Mar 2010 17:18:39 -0400, Walter Bright <[email protected]> wrote:

bearophile wrote:
Glad to see that the answers I've written for that article aren't useless. But someone else has to file this bug because I am am not expert enough to
write it.



http://d.puremagic.com/issues/show_bug.cgi?id=3977
 Gah, I knew I'd be too late :)  Took me a while to find it.
Marked as a duplicate of http://d.puremagic.com/issues/show_bug.cgi?id=2095

It seems this bug keeps getting rediscovered!

It's not really an easy problem to solve. With const, it sort of works, but now all the objects are treated as const, whereas the thing you really want to treat as const is the class references and array (head-const). Imagine if you wanted to call a mutable method on each of the array objects as defined by the base-class. Such an operation is not invalid.

A perfect example of this is sort. Sort can be compiled once for objects, but you would not be able to pass an array of derived objects into the same sort routine, because it would turn them into const objects (non-swappable).

-Steve

Reply via email to