From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c7d533acec91ae16 X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Question for the folks who designed Ada95 Date: 1999/04/28 Message-ID: #1/1 X-Deja-AN: 471973241 Sender: bobduff@world.std.com (Robert A Duff) References: <7g2qu4$ca4$1@usenet.rational.com> <7g3b5g$p92$1@nnrp1.dejanews.com> <7g4ae3$hjh2@ftp.kvaerner.com> <3725C49E.8106A44B@aasaa.ofe.org> <7g4mrs$v5n$1@nnrp1.dejanews.com> <7g72rf$hjh3@ftp.kvaerner.com> <7g7g3j$f95$1@nnrp1.dejanews.com> <7g7hbe$gn5$1@nnrp1.dejanews.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1999-04-28T00:00:00+00:00 List-Id: Robert Dewar writes: > What is missing from this discussion is an argument that > it is advantageous to distinguish array and function > references ... Yes, people want [] because they are > used to it from (some) other languages, but that's a > very weak argument. Function calls can have side effects; array indexing does not. It seems useful to distinguish those two. I have also pondered the idea of having a language where function calls with side effects have a different notation than function calls without. Or perhaps I mean function calls with side effects or that depend on side effects, vs pure mathematical functions. This would require a fair amount of additional information in the program about which functions can read/write which variables. Of course the rules would be conservative, as all compile-time rules must be (unless, of course, you can figure out how to solve the halting problem ;-)) -- I guess memo-izing functions would have to look impure to the compiler, even though they might be provably pure at some level of abstraction. Ada has pragma Pure, which is a step in the direction I'm thinking about. You can tell I'm not in the fanatically anti-side-effect camp. It seems to me that *most* side effects in functions are bad, but some are fairly harmless, and it would at least be nice to be able to tell the difference easily when reading the code. In fact, the ability to tell the difference easily would make side effects *less* harmful -- the main reason they're bad, is that they surprise you. - Bob -- Change robert to bob to get my real email address. Sorry.