unpaintable (the solution to logical const)

Bill Baxter dnewsgroup at billbaxter.com
Sat Apr 5 15:12:13 PDT 2008


Jason House wrote:
> Janice Caron wrote:
> 
>> On 05/04/2008, Jason House <jason.james.house at gmail.com> wrote:
>>>  My only concern is that stuff like "always int x = 5" could be confused
>>>  as a constant.
>> And let's not forget, the most common use is likely to be to make a
>> mutable field, as in C++. Using a word that suggests const to make
>> something permanently not-const is going to serious compromise the
>> learning curve.
>>
>> That's why I stuck with "unpaintable" for the description. It's a
>> visual metaphor that's easy to picture. You can imagine mutable as
>> white, invariant as grey, const as black, and operations like const(T)
>> as going over T with a pot of black paint. Unpaintable fields are
>> coated with varnish that paint won't stick to. It's not a bad
>> metaphor, but, is "paint" the right verb for "change the constancy?" -
>> I don't know.
> 
> I personally really dislike bolting on the whole painting description into
> how D is explained just so that we can introduce a single keyword.
> 
> What I like about always is that it sort of implies its usage and could be
> placed into documentation with little additional description.  Maybe I'm
> strange, but "always C c" doesn't say immutable day to me.  It seems
> sufficiently different and easy enough to remember.  It also has the very
> nice feature of being short.
> 
> Other interesting alternative I thought of is "quarantine".  Walter might
> like that it'd claim the title of the longest keyword in D :)  

I think "foreach_reverse" holds that claim to fame.  You won't unseat it 
with "quarantine".

> Of course, Walter has stayed out of this whole discussion, so we don't know
> his thoughts.  I get the impression, however, that Walter won't get drawn
> into design debates until he knows his opinion on it...  Meaning that he'll
> either argue adamantly against something and then reverse his opinion in a
> bombshell e-mail or stay quiet.  If only someone could find out what he and
> Andrei are thinking about this.

My guess is that if Walter is even aware of what the discussion is 
about, he's thinking "now is not the time".  Similar to what he said 
about pure recently.  His plan is to make it restrictive at first, and 
if that works out well, then perhaps gradually play around with lifting 
restrictions.  This is similar.  It doesn't require a fundamental 
redesign.  It can be bolted on later after the basics are all worked out 
as far as I can tell.

--bb



More information about the Digitalmars-d mailing list