Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!chaph.usc.edu!usc.edu!news From: news@usc.edu Newsgroups: comp.lang.misc Subject: Re: The Universal Language Message-ID: <11502@chaph.usc.edu> Date: 18 Aug 90 17:41:19 GMT References: <24043@megaron.cs.arizona.edu> <6465@helios.ee.lbl.gov> Sender: news@chaph.usc.edu Organization: University of Southern California, Los Angeles, CA Lines: 54 Nntp-Posting-Host: aludra.usc.edu In-reply-to: austern@ux5.lbl.gov's message of 13 Aug 90 18:24:58 GMT Originator: news@aludra.usc.edu In article <6465@helios.ee.lbl.gov> austern@ux5.lbl.gov (Matt Austern) writes: In article <24043@megaron.cs.arizona.edu>, gudeman@cs (David Gudeman) writes: >I am always disturbed by the idea that for a language to have some >good property, it must forbid the programmer from doing X. not to be confused with 'If some other language allows Y, I must implement it in the same fashion.' I'm sure that this is obvious to everybody, but I think it bears repeating: if the "good property" is efficiency, this is often best achieved by forbidding the programmer from using certain constructions. by forbidding? hmm.. true if you note the qualifier "often best" The more assumptions a compiler can make about a program, the better it can do the optimization, and in many cases, the only way a compiler can safely assume that a programmer doesn't do something is to make it illegal. (The C calling convention is more complicated than the FORTRAN calling convention, for example, because C allows recursion. Can you really imagine a C compiler/linker that can prove that a program has no recursive calls, and use a simpler calling convention for such programs?) It is not a requirement that a language require ___ to be illegal. 'Illegal' generally means that a good implementation has not been thought of, or at least has not been implemented. For example, with recursion, if you were implementing C on a machine where recursion was expensive, would you not at least check the simple cases to see if a simpler calling protocol could be used? C has a problem where you can take a address of an object, pass it around globally, and every function you call might have access to it. There are, however, things you can do to trace the propagation of such addresses. In the general case this is too hard to do, but in many simple cases the compiler could be made to recognize a no-aliasing condition, and take advantage of it. (e.g. address always localized, and only passed to pure functions, or easier, address of object never used except within the context of a single line: a[i] or such.) Admittedly, this does require 'global' analysis, and in the most general case (globals in large programs) this might become quite impractical. I'm trying to say that clever implementation can get around many considerations which would otherwise impair a language. There really is a tension between flexibility and ease of optimization, and the resolution isn't necessarily the same for all purposes. true :) wulkwa