[concurrency-interest] Re: AtomicInteger and AtomicLong should implement Number

Dawid Kurzyniec dawidk@mathcs.emory.edu
Tue, 13 Jan 2004 11:54:39 -0500

> -----Original Message-----
> From: concurrency-interest-admin@cs.oswego.edu 
> [mailto:concurrency-interest-admin@cs.oswego.edu] On Behalf 
> Of Larry Riedel
> Sent: Tuesday, January 13, 2004 2:32 AM
> To: concurrency-interest@altair.cs.oswego.edu
> Subject: [concurrency-interest] Re: AtomicInteger and 
> AtomicLong should implement Number

> My perspective is that a sine qua non of this thread 
> ("AtomicInteger and AtomicLong should implement Number") is 
> the idea of assumption of the type of the guarded/wrapped 
> entity by the class of wrapper object. 

The type of the guarded object is a mutable primitive value. By your
argument, the type of the wrapper is also, conceptually, a mutable
primitive. But mutable things have no place in hashing and sorting
algorithms. Ergo: atomics should not provide value-based comparison.

> > I claim that there is not a single legitimate use of value-based 
> > comparison methods for AtomicX classes, and this claim so 
> far has not 
> > been proven wrong.
> Such an opinion cannot be proved right or wrong.  

If it was wrong, it would be easy to prove just by showing a
counterexample :)