const sucks

Derek Parnell derek at psych.ward
Sun Oct 19 13:50:21 PDT 2008


On Sat, 18 Oct 2008 20:36:51 -0700, Walter Bright wrote:

> The problem is things like:
> 
>    void foo(int[] a)
>    {
>      int[] b;
>    }
> 
> so a is const, and b is mutable? That's very confusing. It gives the 
> appearance of D having a lot of wacky and arbitrary semantic rules.

I work with the Euphoria language and this has been the case since its
begining. No one, from newbie-coder to experienced coders of a number of
languages have EVER thought this as weird.

In Euphoria, there is NO WAY one can change a function's argument. The
caller of a function can have complete confidence that any argument passed
will not have its value changed by the function. However, variables local
to the function are not immutable.

Your fears may need empirical evidence before I would take them seriously.


-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list