home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.edu:1576 comp.lang.misc:2971
- Path: sparky!uunet!cis.ohio-state.edu!sample.eng.ohio-state.edu!purdue!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin
- From: hrubin@pop.stat.purdue.edu (Herman Rubin)
- Newsgroups: comp.edu,comp.lang.misc
- Subject: Re: Re: Scientists as Programmers (was Re: Small Language Wanted)
- Message-ID: <Bu9tzC.3Ls@mentor.cc.purdue.edu>
- Date: 8 Sep 92 17:59:35 GMT
- References: <Bu08uF.HBC@mentor.cc.purdue <KERS.92Sep4154056@cdollin.hpl.hp.com> <135691@lll-winken.LLNL.GOV>
- Sender: news@mentor.cc.purdue.edu (USENET News)
- Distribution: na
- Organization: Purdue University Statistics Department
- Lines: 49
-
- In article <135691@lll-winken.LLNL.GOV> blair@lll-crg.llnl.gov (Gary Blair) writes:
- >In article <KERS.92Sep4154056@cdollin.hpl.hp.com> kers@hplb.hpl.hp.com (Chris Dollin) writes:
- >>In article ... fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
-
- >> C++ allows you to overload existing operators, although to make compiler
- >> writer's jobs easier, it does not allow you to introduce new operators.
-
- >>Make that ``trivially easier''. So far as I am able to tell, the difficulty of
- >>allowing the user to add new operator definitions is rather close to zero, so
- >>long as this is taken into account *before* designing the language and
- >>compiler. (C++ has the problem of trying to incorporate the lexical structure
- >>of C.)
-
-
-
- >Wrong. If your compiler uses ANY kind of table-driven parsing scheme, it is
- >next to impossible to allow programmer-defined operators. The parser must
- >know what an operator looks like, and what precedence it has with respect
- >to all other operators. This is usually predetermined, at
- >compiler-generation time.
-
- What you have just said is that if it is not taken into account before
- designing the language and compiler, it is hard to take into account
- later. This has not been disputed.
-
- Far too much emphasis has been placed on the problem of precedence. For
- combinations other than the usual arithmetic ones, and precedence for
- unary operators over n-ary, programmers who do not know for sure should
- use parentheses, or even transient values rather than concatenating the
- operations. Unless rewriting is allowed using algebraic (even in the
- extended sense) properties, the compiler has to do this anyhow. And
- even if the rewriting is done, it will still have to do this. So let
- the programmer in on the act.
-
- Similar problems occur with operations which naturally return a list of
- values. There is much anguish about calls having side effects; this is
- due to a function call producing results, or changing results, besides
- the explicit output value. These are far from uncommon.
-
- What is the purpose of a language/compiler combination? To enable the
- USER to write better code faster. It is not for the convenience of the
- compiler writer or language designer. The same holds for language
- design principles; it is not the beauty or the purity of the product
- which counts, but how well it does the job.
- --
- Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
- Phone: (317)494-6054
- hrubin@pop.stat.purdue.edu (Internet, bitnet)
- {purdue,pur-ee}!pop.stat!hrubin(UUCP)
-