any news on const/invariant?
Bill Baxter
dnewsgroup at billbaxter.com
Tue Nov 27 09:54:36 PST 2007
Michel Fortin wrote:
> On 2007-11-26 18:20:18 -0500, Extrawurst <spam at extrawurst.org> said:
>
>>>> I didn't spend too much looking through the changes, but it looked
>>>> like D is going to be switching to the C++ style of flagging 'this'
>>>> as const by putting 'const' at the end of the function signature
>>>> rather than the beginning.
>>>
>>> At the beginning will still work for function types. The at the end
>>> option is there for those who are building complex type declarations.
>>
>> honestly i would prefer just one single way of writing things.
>> allowing multiple ways makes it less simple to understand external
>> code for beginners. this is one thing i like about java that there
>> hardly exist multiple ways to formulate the same piece of code.
>
> I second that: the language should help make code consistent. I don't
> really care which syntax is kept in the language, but in my opinion
> Walter should decide on one, not two.
>
> Allowing both seems like a compromise to make C++ switchers happy by
> permitting const at the end of a member function (as in C++), but I
> think it just makes the differences about const even more subtle and
> thus harder to learn to that group.
>
> Or is there another rationale I'm missing for having the two syntaxes?
I agree. I don't get why we need two ways to express it. What's the
benefit of writing const out in front?
--bb
More information about the Digitalmars-d
mailing list