opMul

Dave Dave_member at pathlink.com
Sat Mar 8 15:51:44 PST 2008


"Janice Caron" <caron800 at googlemail.com> wrote in message 
news:mailman.134.1205002850.2351.digitalmars-d at puremagic.com...
> On 08/03/2008, Dave <Dave_member at pathlink.com> wrote:
>>  Janice, why has it been "shot down" in the past?
>>
>>  Thanks,
>
> Simple answer: Walter either doesn't like it or has more important
> things to work on.
>
> In fairness, this isn't the /only/ idea which has been suggested, and
> I think some people did complain about the extra typing it would need.
> Another suggestion was
>
>    T const f()
>

I like that one also.

> (the idea being that const applies to whatever is immediately to its
> right). I do kinda like that one too, but Walter shot that one down,
> primarily I think because it means you can't group multiple functions
> together under a single "const" attribute. The "const(this)" idea
> doesn't suffer from that disadvantage, but it does mean more typing,
> and I think that so long as "the ranks are split", so to speak, then
> there's no compelling reason for Walter to move to any particular
> choice of solution.
>
> ...indeed, I don't think he even acknowledges that there's a problem.
> I recall Walter saying that people will just get used to it (that's
> from memory, not an exact quote - I apologise if I got that wrong), in
> much the same way that we've got used to C++'s const syntax being
> inconsistent.
>
> Personally, I like "const(this)", despite the extra typing, because it
> opens the door for future expansion (e.g "const(outer)" meaning "this
> function will not modify outer").
>
> Dunno if that answers the question or not. Probably not, but I tried.

Yes, that answers it - thanks.

I think either const(this) or T const f() are prefereable to trailing const.




More information about the Digitalmars-d mailing list