Newsgroups: comp.lang.scheme Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!snitor!doug From: doug@snitor.uucp (Doug Moen) Subject: Named constants in Scheme Message-ID: <1991May18.203022.9325@snitor.uucp> Organization: Siemens Nixdorf References: <1991May15.172635.18635@Think.COM> Date: Sat, 18 May 1991 20:30:22 GMT Lines: 34 chip@soi.UUCP (Chip Morris) writes: >The question is, can a language supply us with a >suitably general, regular style and still permit the kind of analysis >that frees the programmer from worrying overmuch about efficiency in >the small, when, in the last stages, it becomes important? >Perhaps one must grudgingly admit an analysis advantage to Common >Lisp's otherwise distressingly assymetrical treatment of the function >position. >I think that a Schemer's valid excuse should be "oh, my program >doesn't change the meaning of EQ, CAR, etc." And maybe s/he should be >able to rely on analysis tools to assert this to a compiler in the >bulk of cases where it can be deduced. >A laudible goal for a language design is that "simple" programs >can be analyzed as such and efficiently compiled. To what extent does >this conflict with conceptual regularity and generality? Scheme would have the same "analysis advantages" as Common Lisp if it supported named constants; ie, variables which are given values when they are defined, but which cannot be reassigned. We would also want to loosen up the standard to permit primitive procedures to be defined as constants, rather than as variables. This solution is more regular and general than the asymmetric treatment of the function position in Common Lisp, because it permits expressions such as (* pi 2) to be evaluated at compile time, rather than run time, without the need for global program analysis. (This assumes that both * and pi are defined as constants.) Many procedural languages (eg, Algol 68, Pascal, C, Common Lisp) support named constants; why not Scheme? -- Doug Moen | doug@snitor.uucp | uunet!snitor!doug | doug.tor@sni.de (Europe)