home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.object:3041 comp.lang.eiffel:1004
- Newsgroups: comp.object,comp.lang.eiffel
- Path: sparky!uunet!mcsun!sunic!psinntp!psinntp!merlin.hgc.edu!jcm
- From: jcm@hgc.edu (James McKim)
- Subject: Re: Class methods (was: Re: How to design a data structure library)
- Message-ID: <1992Jul28.135521.28003@merlin.hgc.edu>
- Sender: usenet@merlin.hgc.edu (Action News Central)
- Organization: The Hartford Graduate Center
- References: <GEOFF.92Jul27100601@wodehouse.flash.bellcore.com> <5631@vexpert.dbai.tuwien.ac.at>
- Date: Tue, 28 Jul 1992 13:55:21 GMT
- Lines: 51
-
- In article <5631@vexpert.dbai.tuwien.ac.at> mst@vexpert.dbai.tuwien.ac.at (Markus Stumptner) writes:
- >From article <GEOFF.92Jul27100601@wodehouse.flash.bellcore.com>, by geoff@flash.bellcore.com (Geoffrey Clemm):
- >> I believe you missed the central point of Richie's article, namely that
- >> Eiffel 3.0 has a clean way of handling this situation, to quote:
- >
- >>> !!c.union (a,b);
- >
- >> With which I completely agree. This avoids the unpleasant assymetry
- >> of c:=a.union(b).
- >
- >I did get the point, I just don't like it. I grant that the asymmetry
- >is avoided, but this is outwiehged by the fact that using the class
- >method is, in my opinion, a completely weird way of handling an
- >ordinary binary operator. Sets are a bad example for that construct,
- >since they, as mathematical entities together with their appropriate
- >operators, should correspond fairly closely to, say, integers or
- >floats in this manner. As an example, addition (which closely
- >corresponds to set union) is not a class message, and making it one
- >does not improve the clarity of the code.
- >
-
- [...]
-
- But, addition (set union) can be viewed as a way of combining two
- integers (sets) to form a _new_ one. The very fact that the result is
- _new_ indicates some form of creation.
-
- What I think we're leading up to here is a distinction between two
- kinds of queries:
- 1) Those that _clearly_ return some new object: union of two
- sets, concatenation of two lists, etc.
-
- 2) Those that don't: top of a stack, length of a list, etc.
-
-
- In order to qualify under (1) the result of the query must be
- heavily dependent on the parameters of the query. If the result
- only depends on the state of the object, then the design of the
- class should allow the implementor the flexibility of precomputing
- and storing the result of the query in anticipation of future access.
- For example the length of a list can be constantly maintained or
- computed on demand and so falls under (2). (Meyer has a name for
- this kind of transparency which escapes me at the moment.)
-
- Regards,
- -- Jim
- --
-
- *------------------------------------------------------------------------------*
- Jim McKim (203)-548-2458 In exactly 3.2 seconds it will be a few
- Internet: jcm@hgc.edu minutes to 5:00.
-