What is Invariant Good For?

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Aug 11 12:02:18 PDT 2008


Paul D. Anderson wrote:
> Bruce Adams Wrote:
> 
>> On Sun, 03 Aug 2008 02:52:10 +0100, Sean Kelly <sean at invisibleduck.org>  
>> wrote:
>>
>>> == Quote from Walter Bright (newshound1 at digitalmars.com)'s article
>>>> Bruce Adams wrote:
>>>>> It strikes me that 'dibblego' is some kind of troll or an extreme  
>>>> pedant
>>>>> from a parallel experience.
>>>>> I'm not sure how much communicating with it is educational. I  
>>>> understand
>>>>> all the terms he's using but none of the meanings he
>>>>> is ascribing to them. And calling you a pseudo intellectual for no
>>>>> obvious reason strikes me as very troll-like not to mention
>>>>> rude.
>>>> His post missed the point of the article by focusing on the definition
>>>> of a word. At some point, who cares what the word is, it's the concept
>>>> that matters.
>>> But words represent concepts... generally very specific ones.  It's why
>>> writing poetry is so darn hard.
>> Actually its quite the reverse. In normal usage (insert your definition
>> of normal here) words have several grey, slightly overlapping and fuzzy  
>> meanings.
>> And that's ignoring the synonyms and sounds-a-likes. Its only when you try  
>> to
>> write in a so called technical English that meanings get narrowed down and  
>> eve
>> then it doesn't take much to find a confusing alternate meaning for them.  
>> As
>> programmers we are uniquely blessed/cursed with 'words' that mean  
>> precisely one
>> thing when passed to a specific compiler in a certain context. :-)
>>
>> Regards,
>>
>> Bruce.
> 
> All true, but the keywords that are most controversial are ones that are overloaded to mean different things in different contexts.
> 
> The best example is "enum". Walter correctly observes that, from a compiler designer's point of view, a list of enumerated values is the same as a "manifest constant", so he re-uses the keyword. To a programmer (or at least this progammer) the two things are conceptually different, used for different reasons. I find the usage confusing.
> 
> This sort of thing is common when you put engineers in charge of the user interface. The aspects of the problem that are important to the implementation are paramount to the implementer and it's easy to lose sight of the fact that the user doesn't care. What's intuitive to the user is not what's intuitive to the designer.
> 
> "Invariant" has a specific meaning to programmers with respect to contracts.  "Invariant" as Walter uses it is the same, but different. It is illuminating that those who commented on Walter's article focussed on the keyword and not on the concept. It's the intuition of the designer not matching the intuition of the user again.
> 
> I know we went round and round regarding this keyword and Walter's right -- at some point you just have to make a decision and go with it. But when there's so much complaint about the decision it may be time to reconsider.
> 
> Paul
> 

Although I think 'immutable' is preferable over 'invariant', I only 
think it's *slightly* preferable, and don't have much of a beef with 
'invariant'. I would reckon much of the rest of the community also 
doesn't mind 'invariant'.
The real beef was 'const', that a lot of people (myself included) 
thought it wasn't very adequate and other alternatives such as 
'readonly' were preferred. But frankly, I cant' say this is an issue on 
the top list of things that I find troublesome in D.

-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list