Why the need for an only const ref?

Janice Caron caron800 at googlemail.com
Sat Dec 1 22:09:18 PST 2007


On 12/1/07, Derek Parnell <derek at psych.ward> wrote:
> (a) D can't to X
> (b) To try to do X in D is stupid
> (c) X is a valid paradigm

I think the point is the case for head-const as a useful paradigm is
very weak. To use your own example. All you have to do is rewrite it
like this:

    char[MAXBUFSIZE] buffer;
    ...
    buffer ~= "abc"; // Error

Or, if you're passing it to a function, wrap it in a class or struct

    class Buffer
    {
        char[MAXBUFSIZE] buffer;
    }

    f(Buffer b)
    {
        buffer ~= "abc"; // Error
    }

> Walter, the BD of D, has been known to change his mind.

Sorry, I don't understand what BD of D means.

In any case, I think Walter will change his mind if there is a strong
enough case. If this newsgroup shows near-unanimous support, and
real-world test cases can be demonstrated. That doesn't seem to be the
case here.



More information about the Digitalmars-d mailing list