const challenge

Sean Kelly sean at f4.ca
Fri Feb 1 10:20:39 PST 2008


Janice Caron wrote:
> On 2/1/08, Sean Kelly <sean at f4.ca> wrote:
>> Requiring casts here seems like a blatant flaw in the current design.
> 
> I agree. But I gather Andrei, at least, is working on fixing it.

Yes, thanks to Steven's bug report.  What bothers me is that it
apparently took a bug report and a follow-up argument to get this
addressed.  I'm all for making things illegal until there is a
substantive argument for why they should not be, but this particular
feature is so fundamental that I'm quite honestly shocked that it was
left un-addressed.

>> Quite frankly, I'm
>> shocked that the const features were considered complete with something
>> like this in place.
> 
> Has anyone said they're considered complete?

Walter said so to me privately recently.  I asked him about it because I
didn't want to devote the time to porting Tango if there was any chance
that the design may change.

> I don't think anyone
> considers const to be finalized yet. It's still a work in progress,
> and there are still one or two niggles remaining, which get brought up
> from time to time. I guess we all assume that the wrinkles will get
> ironed out in time.

See above.  However, in this particular case, changing the way these
expressions are handled won't break any code.  It will simply eliminate
the necessity for cast operations.  So I suppose one could argue that
the syntax has been finalized but the implementation may still be
tweaked a bit.

> I think it's more that the "cutting edge brigade" /expect/ things to
> have a few problems, and so aren't that distressed when we encounter
> them. We just figure out workarounds, and then post about it.
> Eventually, the workaround stops being needed. (...we would hope).

I suppose I've always been a bit different then.  If I encounter
something that seems broken I'll generally avoid it until it works
properly.  Traditionally, I would have posted a proposal or critique
about it as well, but I've become a bit jaded about this over time.  At
this point it's more likely that I'll just spend the hour working on
something productive rather than writing a long post that will be
probably be ignored (this is how I feel, even if it isn't true).

> I have to say, I love D2. I love the const features. I can live with
> the annoyances (for now) because I think we're working towards
> something marvellous.

To be honest, I have trepidations about 2.0, largely for what many would
feel are silly reasons.  For example, I simply don't find the aesthetics
of the new features appealing.  And while many might say this aesthetics
are unimportant, they are a significant reason why I initially switched
to D from C++.

For the rest, I am mostly waiting for 2.0 to get some of the features
that I actually care about.  Being a long-time C++ person one might
think that I would consider const to be tremendously important, but
experience with it has mostly made me feel that const is often more
trouble than it's worth.  In large projects, I more often find myself
struggling against other programmer's inconsistent choices of how to
apply const to their designs than I do benefiting from any apparent
security that it provides.  That said, I do think that the choice for
transitive const in D will help tremendously, because it mandates
consistency of design.


Sean



More information about the Digitalmars-d mailing list