home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.object:3059 comp.lang.eiffel:1021
- Newsgroups: comp.object,comp.lang.eiffel
- Path: sparky!uunet!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: <1992Jul29.140357.26748@merlin.hgc.edu>
- Sender: usenet@merlin.hgc.edu (Action News Central)
- Organization: The Hartford Graduate Center
- References: <1992Jul27.155428.11825@bony1.bony.com> <graham.712283419@galois> <1992Jul28.201820.27793@bony1.bony.com>
- Date: Wed, 29 Jul 1992 14:03:57 GMT
- Lines: 63
-
- In article <1992Jul28.201820.27793@bony1.bony.com> richieb@bony1.bony.com (Richard Bielak) writes:
- >In article <graham.712283419@galois> graham@maths.su.oz.au (Graham Matthews) writes:
- >
- >[...]
- >
- >>
- >>Are you really serious about this notation Richie? This means that
- >>I would have to write integer addition as
- >>
- >> !!c.+(6,7);
- >>
- >>After all it creates a new integer!
- >>
- >
- >It's not the notation that I'm arguing for.
- >
- >!!c.+(6,7) is certainly awful syntax. But, (as Jim McKim suggested in
- >private e-mail) couldn't the compiler do the translation from c := 6 +
- >7; to the above monstrocity.
-
- Well, before I get flamed too badly for the above suggestion, let me
- say that I haven't fully thought it out. I think the compiler would
- have to be smart enough _not_ to make the above translation in the case of
- simple integer arithmetic.
-
- >
- >My point is that certain methods, "+" for example, should be class
- >(i.e. creation) methods.
-
- Yes, it's really the design of the _class_ that originally sparked
- this discussion, not the syntax used. It does seem that designing
- the standard set operations, string operations, etc as creation
- routines is an idea worth pursuing.
-
- >
- >However, once you get away from numbers, with their historical
- >notation, things make more sense. How about a "concat" method on
- >strings. We'd have:
- >
- > !!s.concat("foo", junk);
-
- People will argue that this could be written as either
- s := "foo" + junk a la Turbo Pascal or
- s := "foo" concat junk
-
- If we can get the compiler to translate the latter two into the
- former, we can have our simple syntax and our clean design, too.
- But again, I don't know how smart the compiler would have to be
- in order to accomplish this.
-
- >
- >
- >
- >...richie
- >
- >--
-
- -- Jim
- --
-
- *------------------------------------------------------------------------------*
- Jim McKim (203)-548-2458 In exactly 3.2 seconds it will be a few
- Internet: jcm@hgc.edu minutes to 5:00.
-