why no ++?

Quinn Dunkan quinn at retch.ugcs.caltech.edu
Tue Aug 7 17:04:22 EDT 2001


On Tue, 7 Aug 2001 18:03:44 +0200, Alex Martelli <aleaxit at yahoo.com> wrote:
>"Quinn Dunkan" <quinn at retch.ugcs.caltech.edu> wrote in message
>news:slrn9mu445.62q.quinn at retch.ugcs.caltech.edu...
>    ...
>> Eiffel goes even further with this, for example:
>>
>> fp.read_line
>> s := fp.last_string
>>
>> I haven't decided yet if this consistency is of the hobgoblin variety or
>not.
>
>To me, it seems cleverly designed to maximize threading
>problems/race-conditions/horrid-bugs.

That's what I first thought as well.  In addition, := assigns references and
strings are mutable, so you really need clone(fp.last_string) to avoid
aliasing.

One counter argument is that if state-changing operations are isolated and
seperate from queries it's easier to lock your state changing operations, and
then let the rest of the code that uses the queries run in parallel.

I don't see how that buys you much when there's a 1:1 between commands and
queries, though.  It also assumes that all threads want the object to be in
the same state, which seems unlikely.  I can't think of any examples that
cleary demonstrate the counter argument either.

Presumably Meyer has more rationale in OOSC so I don't have an opinion until
I've read that (though I've found some of Meyer's rationales unconvincing in
the past).



More information about the Python-list mailing list