Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!decwrl.dec.com!tomr From: tomr@DECWRL.DEC.COM (Tom Rodeheffer) Newsgroups: net.lang.mod2 Subject: scrap INC/DEC vs Overloading Message-ID: <8603102228.AA01471@clark.ARPA> Date: Mon, 10-Mar-86 17:28:00 EST Article-I.D.: clark.8603102228.AA01471 Posted: Mon Mar 10 17:28:00 1986 Date-Received: Wed, 12-Mar-86 05:46:59 EST References: <8603091851.AA07620@orb.sun.uucp> Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 29 Rob Nagler argues that INC and DEC don't need to be in the language, rather they should be optimized by the compiler or provided by an Assembly language module. Well, not that I particularly like INC and DEC, but they have the property that you can feed them a variable of any discrete type. Modula-2 doesn't have the facilities to allow you to declare a procedure that does the same thing. Hence you can't banish INC and DEC from the language into a standard library module without changing their meaning. Now you can say 1) Let's add features to Modula-2 to allow us to write our own procedures such as INC and DEC, then INC and DEC won't be special any more; this leads down the path toward overloading. Or you can say 2) Because we can't write procedures such as INC and DEC let's chip a wart off the language by eliminating them. Or you can say 3) Overloading looks like a real tarpit but we sure would like to be able to do INC and DEC on enumerated types, let's just stick a hack into the language and be done with it. State 3) is where we're currently at. Tom Rodeheffer P.S. By the way, does anybody have an idea why Wirth dumped SUCC and PRED when he went from Pascal to Modula? I really hate writing VAL(SomeModule.SomeType,ORD(expression)+1) instead of SUCC(expression), and it's even more disgusting to cons up a new variable in order to use INC. -Tom R