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

Gregg Wonderly gregg.wonderly@pobox.com
Fri, 09 Jan 2004 18:52:04 -0600

Dawid Kurzyniec wrote:
> Also, to argue on the "philosophical" level why numbers in Java are
> immutable: 2 is a number, and 3 is a number, but something which can be
> sometimes 2 and sometimes 3 is not a number, it is a variable (or number
> holder which you can query for its momentary value). Java builds upon
> that definition: everything that extends the Number is immutable. This,
> for instance, allows to sort arrays of numbers regardless of the actual
> type. Proposed change would violate this.

What your suggesting is that somehow we already know every single use 
case of every single moment that these values will be used, and that 
there will never be a moment that the programmer will know what they are 
doing and can in fact compare, sort, manipulate or examine them.

An example that comes to my mind is instrumentation.  If I am counting 
some things and then wish to 'pause', sort and examine, I should be able 
to do that using a programming model that is recognizable.  If these 
objects are not Number decendents, then suddenly all kinds of friendly 
comparison, trending, graphing etc code has to suddenly be replicated 
just to accomidate these values.