From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!ukc!inmos!mph@lion.inmos.co.uk From: mph@lion.inmos.co.uk (Mike Harrison) Newsgroups: comp.lang.ada Subject: Re: Ada functions versus arrays (i.e. () vs [] ) Message-ID: <4319@ganymede.inmos.co.uk> Date: 2 Mar 90 10:56:48 GMT References: <184@trwacs.UUCP> <598@software.software.org> <5619@crdgw1.crd.ge.com> <608@software.software.org> <6281@bd.sei.cmu.edu> Sender: news@inmos.co.uk Reply-To: mph@inmos.co.uk (Mike Harrison) Organization: INMOS Limited, Bristol, UK. List-Id: In article <6281@bd.sei.cmu.edu> firth@sei.cmu.edu (Robert Firth) writes: >As a second example, consider a dictionary used by a spelling checker. >There is a function Check(W) that checks whether W is in the dictionary. >Many implementations of this function are adaptive: they use a temporary >cache of some kind that is dynamically reorganised so that words >occurring frequently in the document in question float to the front. >Over a long document, this can substantially speed the checking process. >Again, this is a benign and proper use of side effects within a function. I question whether this is really a side-effect. Clearly it is a side-effect at the level of the implementation, in that it causes a change of state from a call of the function, but if you view the function as a mapping from elements of its domain to elements of its range then there is no observable change at the appropriate level of abstraction. This is not a disagreement with Robert's point, because the Ada code of the function body will clearly cause side-effects. It is rather an attempt to point out that 'pernicious' side-effects are those which are visible at the same level of abstraction as the function definition, rather than its implementation. The problem is writing a compiler which can recognise the distinction. Mike, Michael P. Harrison - Software Group - Inmos Ltd. UK. ----------------------------------------------------------- UK : mph@inmos.co.uk with STANDARD_DISCLAIMERS; US : mph@inmos.com use STANDARD_DISCLAIMERS;