Xref: utzoo comp.object:3755 comp.lang.eiffel:1680 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!olivea!tardis!tymix!uunet!mcsun!ukc!pyrltd!tetrauk!rick From: rick@tetrauk.UUCP (Rick Jones) Newsgroups: comp.object,comp.lang.eiffel Subject: Re: Functions without side effects (was Old confusion) Message-ID: <1192@tetrauk.UUCP> Date: 19 Jun 91 09:30:36 GMT References: <130242@tut.cis.ohio-state.edu> <1991Jun5.072556.19870@irisa.fr> <1991Jun5.083241.13145@tkou02.enet.dec.com> <956@puck.mrcu> <1186@tetrauk> <1991Jun17.141842.25702@mstr.hgc.edu> Reply-To: rick@tetrauk.UUCP (Rick Jones) Organization: Tetra Ltd., Maidenhead, UK Lines: 44 In article <1991Jun17.141842.25702@mstr.hgc.edu> jcm@mstr.hgc.edu (James McKim) writes: |In article <1186@tetrauk.UUCP> rick@tetrauk.UUCP (Rick Jones) writes: |> |>Wait for Eiffel version 3! (not long now, I hope). | |Second that (e)motion! And where/how can I get the latest |_Eiffel: The Language_ ASAP? It's due for publication in July - I have a final draft copy (one of the priveleges of being a member of NICE :-). |> It will support a construct |>"strip" which means "the attributes of this object, except for given to strip>". If there are no parameters, it is all the attributes. Then |>the postcondition "strip = old strip" means "no change". Since strip allows |>you to explicitly omit specified attributes, you can write a postcondition |>which means "no change to any attributes except those specified". So by |>omitting attributes which only affect internal state, the postcondition can |>ensure that the important things are unchanged, even though the internal state |>may have been modified. |> |Hmmm. Is "strip" included in the public interface? Offhand, it seems it |should _not_ be since, if I understand correctly, it may include parameters |that are private attributes. "strip" is not a feature that can be part of a class interface - it is a language keyword, and its use will yield the attributes of the current object, as seen by the class in which the strip construct is used. This means that even if the object is an instance of a descendant class which introduces new attributes, these attributes will not be included in the result of "strip". It is only really intended for use in postconditions; if you wanted to export the result of a strip expression (which syntactically is an ARRAY[ANY] object), you would have to write a function to do so. (to be precise, you would not actually write "strip = old strip" as I wrote before, the correct expression is "equal (strip, old strip)" - I thought I'd better put that in before someone picks me up on it!) -- Rick Jones, Tetra Ltd. Maidenhead, Berks, UK rick@tetrauk.uucp Chairman, NICE (Non-profit International Consortium for Eiffel) Any fool can provide a solution - the problem is to understand the problem