Constant relationships between non-constant objects
Sebastian Unger via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 17 19:26:24 PDT 2014
On Wednesday, 18 June 2014 at 02:15:21 UTC, Jesse Phillips wrote:
> On Wednesday, 18 June 2014 at 01:31:33 UTC, Sebastian Unger
> wrote:
>> Or has D really done away with the MOST important use case of
>> const (preventing developer mistakes! Not optimization.)
>>
>> Cheers,
>> Seb
>
> Yes. D does not provide head-const.
>
> Though I would disagree that it is the most important use-case
> for const.
But can you agree that it is AN important use case? If so, what
was the rationale to not include a feature in D that has been
used with great success in other languages? Don't get me wrong, I
really like immutable and const and the fact that they are
transitive. There are good use cases for this.
But why NOT include head-const if there are also good use cases
for it? Too afraid your users won't know the difference and use
the wrong one? Well, that's counter productive because now the
can't use any form of protection from the compiler in this (very
valid and VERY prevalent) use case.
I came across this a few hours into my very first small project
using D. That tells you how common this use case is.
I'd stronly argue for D getting that feature. If I can't express
some of the most basic constructs in OOD in D, it really falls
more into the category of a toy language for me.
Cheers,
Seb
More information about the Digitalmars-d
mailing list