const sucks

Bill Baxter wbaxter at gmail.com
Mon Oct 20 06:18:13 PDT 2008


On Mon, Oct 20, 2008 at 6:14 AM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Derek Parnell wrote:
>>
>> 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.
>
> Well claiming that you know what everybody using Euphoria has ever thought
> sets the standard pretty low in terms of evidence.

Although I'm 90% sure Derek just mean that he's never seen anyone
complain about it on the Euphoria mailing list, it's not a bad
suggestion to collect some harder data.   Derek, if you didn't already
do this the last time const by default came up, how about taking a
survey on the Euphoria mailing list?  Ask if anyone finds (or found at
first) the immutable parameters to be confusing.

--bb



More information about the Digitalmars-d mailing list