home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.object
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!spool.mu.edu!yale.edu!ira.uka.de!chx400!bernina!neptune!santas
- From: santas@inf.ethz.ch (Philip)
- Subject: Re: Object hidden state and side effects
- Message-ID: <1992Dec23.013714.1769@neptune.inf.ethz.ch>
- Sender: news@neptune.inf.ethz.ch (Mr News)
- Nntp-Posting-Host: ru8.inf.ethz.ch
- Organization: Dept. Informatik, Swiss Federal Institute of Technology (ETH), Zurich, CH
- References: <knight.724800099@cunews> <BzMnKp.B4J@inews.Intel.COM> <BzMpwB.7y3@newsflash.concordia.ca>
- Date: Wed, 23 Dec 1992 01:37:14 GMT
- Lines: 53
-
-
- In article <BzMpwB.7y3@newsflash.concordia.ca> grogono@cs.concordia.ca (Peter Grogono) writes:
- >bongalon@tcad05.intel.com (Ben Bongalon) writes:
- >>
- >>why would you want to consider "i" and "(i^5)" as equal but not
- >>identical values? Do you consider "1" and "(3-2)" equal but not
- >>identical also? From a pragmatic point of view, the distinction
- >>between the simplified and unsimplified forms of the expressions
- >>seem questionable.
- >
- >It depends what you mean by "pragmatic". It is true that, when we are
- >thinking informally, there is not much difference between "1" and
- >"3-2". But there is a vast difference computationally.
-
- Quite agree. To reinforce this argument, the distinction is not only in
- terms of computational effort, but also in terms of consistency of operations.
- Simplifications performed globaly, without any type information,
- can lead to unexpected results:
- consider the case:
- random() - random()
- or to think of the example above:
- (random()+1) - random()
-
- >Many
- >languages, including Prolog, are formally defined as term languages.
- >In a term language, "1" and "3-2" are different terms and are thererfore
- >unequal. A Prolog interpreter needs a simplifier, which would not be
- >part of a "formal" implementation, to turn one into the other.
- >The consequence is that arithmetic predicates behave differently
- >from other predicates, although implementations try to hide this as
- >much as they can.
-
- Unfortunately. One of the main reasons here is that term rewritting, and
- pattern based systems use _global_ optimization techniques, and exclude
- type information from their algorithms (implmentation of numbers is the
- exception). This leads again to strange results, since one might expect
- that, from the overall behaviour of the system, 3-2 is different from 1.
-
- Use of pure functions without predefined pattern matching, is the only
- available solution to this problem, as functional languages demonstrate.
-
- Philip Santas
-
- "In an evolving universe those who stand still are really moving backwards"
- --------------------------------------------------------------------------------
- email: santas@inf.ethz.ch Philip Santas
- Mail: Dept. Informatik Inst. of Scientific Computation
- ETH-Zentrum Swiss Federal Institute of Technology
- CH-8092 Zurich Zurich, Switzerland
- Switzerland
- Phone: +41-1-2547478
-
-
-