From: knight@mrco.carleton.ca (Alan Knight)
Subject: Re: Object hidden state and side effects
Reply-To: knight@mrco.carleton.ca (Alan Knight)
Organization: Carleton University
Date: Wed, 16 Dec 1992 03:37:35 GMT

In <1992Dec11.163449.18439@crd.ge.com> eaker@ukulele.crd.ge.com (Chuck Eaker) writes:

>In article <knight.724021213@cunews>, knight@mrco.carleton.ca (Alan Knight) writes:

>|> In Smalltalk one cannot delete an object of any kind. One can,
>|> however, create numbers perfectly well. 
>|>   Fraction numerator: 3 denominator: 4 
>|> 
>|> is perfectly valid Smalltalk code which creates a new fraction with
>|> value 3/4. Why is that crazy?

>It's crazy because it is not an example of creating a value. The
>value 3/4 has been around a long time. What this example creates
>is yet another digital representation of that value.

>It is more accurate to say that you have created space, and in
>that space will be placed a bit pattern which represents a value. 
>But even that is a fiction. What is really created is not space
>but a way to refer to a space which can hold only one of many
>things each of which is taken to represent a value or even a range
>of values.

We can never have the value itself, whether in software or in
discourse. All we can do is have symbols that represent a value in
some way. In mathematics we give things names. The written 3/4 here on
your screen is no different from a bit pattern in the computer, and if
I say Let i=3/4 it doesn't matter if I mean it mathematically or as a
statement in a computer program.

>In short, software must use objects to represent values. This is
>why the distinction between values and objects is of enormous
>importance. Software objects are used to model real world objects
>as well as real world values. Modeling objects with other objects
>is far more straight-forward than modeling values with objects.
>The field of numerical analysis is all about the difficulties
>which arise when one is forced to use objects to represent values.

There are no "real-world values", and I personally find it ridiculous
to attempt to identify "objects" in the OO sense with things that can
be picked up and thrown. (I wrote an article which is at least partly
about this in the September 1992 Smalltalk Report). 

This discussion gets very philosophical.  Personally, I think that we
know the set of all marriages in pretty much the same way we know the
set of all reals or the set of all true theorems. I'm not, however,
prepared to do the homework required to debate the issue in full.
Perhaps a crossposting to alt.philosophy.endless.debates is in order.

The original question to which I responded was how it was possible to
have a functional OO language. Those who believe that the fundamental
characteristics of an object are modifiable state and a distinct
identity obviously will not believe it is possible.

On the other hand, if you make a functional language which has
classes, inheritance, polymorphism, encapsulation and dynamic binding,
but not mutable state for instances, I would say you have a functional
OO language (with great acronym potential).  I thought Ralph Johnson
summed it up with his lengthy posting early on in the debate on why he
did not feel it worthwhile to make the distinction.

I should also add that numerical analysis is not about modelling
values with objects, it is about using approximations to represent
quantities. Approximations are just as much values as the things they
approximate. 

-- 
 Alan Knight  knight@mrco.carleton.ca  +1 613 788 2600x1027 
 Dept. of Mechanical and Aerospace Engineering              
 Carleton University, Ottawa, Ontario, Canada, K1S 5B6      

Newsgroups: comp.object