Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!colt.net!feeder.news-service.com!feeder1.cambrium.nl!feed.tweaknews.nl!amsnews11.chello.com!newsfeed01.chello.at!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: OO versus RDB Newsgroups: comp.object,comp.databases.theory User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <449b2eb2$0$31648$e4fe514c@news.xs4all.nl> <449dd059$0$31656$e4fe514c@news.xs4all.nl> <2kxng.7938$Wl.4566@trnddc01> <449ecfdd$0$31642$e4fe514c@news.xs4all.nl> <44a1a679$0$31642$e4fe514c@news.xs4all.nl> <44a2eb4c$0$31652$e4fe514c@news.xs4all.nl> <44a42097$0$31656$e4fe514c@news.xs4all.nl> <1152186211.639700.279770@j8g2000cwa.googlegroups.com> <1152199241.437243.166570@j8g2000cwa.googlegroups.com> <1152200036.255450.235950@p79g2000cwp.googlegroups.com> <1152284113.008096.228950@m73g2000cwd.googlegroups.com> Date: Fri, 7 Jul 2006 20:03:45 +0200 Message-ID: Lines: 42 NNTP-Posting-Date: 07 Jul 2006 20:03:33 MEST NNTP-Posting-Host: a93762ff.newsread4.arcor-online.net X-Trace: DXC=VB493]U>K4FVg>C^g8i1FI:ejgIfPPldDjW\KbG]kaMHLL]:kiR8f=OhbTJVI Marshall wrote: >> Heh. Funny you should mention that. It's also the case that >> one can have a function that writes to global variables >> but doesn't *read* from them, and it will *still* be >> pure, in that the outputs depend only on the inputs. >> >> The functional guys *really* hate it when I say *that*. > > Well maybe that's because you're wrong :-) > > Such a "function" isn't a function at all, and common program > transformations and compiler optimisations (e.g. common sub-expression > elimination) will modify/break programs in such cases. > > Basically, in order to be considered "pure" it is necessary but > not sufficient that the result delivered by a function is dependent > only on the values of it's arguments. It's also necessary that > evaluation has no other observable effect. So a programs observable > behavior is identical whether the same expression is evaluated just > once or several times (or maybe not at all) and is also independent > of evaluation order. Yes. One could say that the effect of a pure subroutine is limited to its parameters and the result. What is computed from what is irrelevant, that's a behaviour, which is only required to be invariant. [ One could imagine a pathological case where the argument might depend on the result: a pure function dispatching on the result which does not touch it, but does an in-out argument, for example, stores there the actual type of the result. (:-)) ] I am not sure about composition (the evaluation time and order). Consider a "pure" subroutine called with an impure closure as the parameter. I would still call such thing pure. It is difficult to mix FP with imperative, but it is worth the efforts, IMO. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de