[concurrency-interest] Re: Improving RWLock compatibility - ownership test

Larry Riedel larryr@saturn.sdsu.edu
30 Nov 2004 16:57:39 -0000


> > Indeed, the notion of "lock" can be defined broadly enough to
> > include such a plethora of non-orthogonal semantics that a
> > reference to a "Lock" is effectively useless without knowledge
> > of the semantics of the class of the referenced object instance.
> 
> Yeah, that Lock interface is practically useless. Let's get rid
> of it. While we're at it, has anyone noticed just how little the
> List interface contributes? The semantics of ArrayList and LinkedList
> are worlds apart, and yet those "experts" keep telling us to gloss
> over the difference with that vacuous interface.

I would agree that to the extent a commonly used operation in
the List interface has qualitative behavior exposed to the
user of that operation which is naively unpredictable without
knowledge of the implementing class, but naively predictable
with that knowledge, it might be worthwhile to add a new
operation to the List interface, add a new interface, or more
precisely specify the behavior of the operation in the interface
rather than leaving it to the implementing class to define.


> That's the great thing about concrete types: you know what you're
> getting all the time, and you don't have to worry that some fool
> has changed the implementation (and subtle semantics) on you.

I would agree that if a method implementation depends on (expects)
semantics of a class which are left unspecified in an interface
that class implements, it may be preferable for the method to use
a reference to the implementing class rather than to the interface.


Larry