Who favors the current D1 situation?
Kris
foo at bar.com
Fri Mar 7 09:53:52 PST 2008
"Walter Bright" <newshound1 at digitalmars.com> wrote in message
news:fqr25f$2d82$1 at digitalmars.com...
> Kris wrote:
>> It is simpler and generally more effective to design an API which avoids
>> the .dup issue.
>
> But you shouldn't *need* to be doing .dup for invariant arrays. If you are
> duping them, there's a problem somewhere else in the code.
Indeed. This is the very argument used to refute your earlier claims about
COW being the true-path <g>. The result of that was to design around the
issue altogether. You certainly won't find me invoking the wrath of
redundant .dup (and surely the mere existence of .idup should ring
alarm-bells).
>> Usage of dup (and idup) is not a good poster-child to hold aloft, when
>> they can be avoided in the vast majority of cases. For example, in all of
>> Tango there's only one instance where a const return would be nice to
>> have, due mostly to an avoidance of the situation. The usage of D1 'in'
>> can suffice for all read-only parameters. Tango is a large body of code,
>> as you know, with attention given to efficiency. One might hope the
>> highly narrow scope therein for D2 const/invariant might indicate
>> something of value for you -- perhaps that const/invariant might slip
>> into a "special consideration" usage instead? If it simplified the syntax
>> and/or usage, a lot of people would be jumping into D2 instead of
>> remaining with D1
>
> You can write bug-free and perfectly correct programs without const or
> invariant at all. But once a code base exceeds a certain level of size and
> complexity (and I don't know what that level is), const/invariant will
> become increasingly valuable. People who do work in large corporations
> managing extremely large codebases with legions of programmers working on
> them have made this abundantly clear to me.
Yes, I agree, and put this argument to you several years ago while COW was
king for D.
My whole point is that D2 has made const/invariant into something that
complicates the usage and comprehension of the language as a whole:
- Yes, read-only attributes can be /very/ useful in specific scenarios.
- Yes, D already supported various (non-const) ways to enable read-only
aggregates
- Yes, D1 already had read-only parameters
- Yes, most people can happily get by without const/invariant
- Yes, there are other valuable uses for invariant that have yet to ripen
(parallelization, for example)
- Yes, the further revised design of const/invariant in D2 still complicate
language usage & comprehension past the level where the tradeoffs make sense
(IMO). I've tried to say this already, and will keep repeating it <g>
>> What I'm saying is effectively this: you don't have to solve all the
>> const cases to still have a stupidly-effective language. The tradeoffs to
>> get there so far are, imo, too costly in areas of comprehension and
>> usability - two huge factors in the attraction of D in the first place.
>> Some folks might disagree, and that's cool.
>
> Part of the problem with const/invariant in D is we burned a lot of
> goodwill with the two previous designs that fell short of the mark. But I
> believe the design now is a sound one (despite the bugs in implementing
> some of the details, many of which were fixed in the latest update).
There's no question here of whether it may or may not be 'sound' ...
instead, it's a question of usability. There's not much value in being the
world's most wonderful companion when one's body-odor is sufficient to keep
everyone at bay - like most things, there's a question of balance. You seem
to think D2 has finally got it right. I disagree, as do many other
large-scale users of the language (the very people who you'd expect to be in
the D2 camp without question).
I'm not here to argue about black or white. Instead I'm attempting to help
you understand the reasons why so few people have adopted D2 .... to
leverage the earlier analogy, D1 ain't a perfect companion but it has very
little body-odor
Hope this helps;
2c
More information about the Digitalmars-d
mailing list