On 11/9/06, Crispin Cowan <[EMAIL PROTECTED]> wrote: >>Prior to Java, resorting to compiling to byte code (e.g. P-code back in >>the Pascal days) was considered a lame kludge because the language >>developers couldn't be bothered to write a real compiler.
I believe that is completely and totally false. If you want to claim p-code itself was lame, fine. But let's keep the history accurate. The UCSD p-system was created in the late 1970's SPECIFICALLY for PORTABILITY of executable code: You could ship p-code to any machine, and it would run. It was the 70s/80s way of getting "Write once, run anywhere". It was sold that way, too; I remember ads pressing hard the notion that you could compile your code once, and it'd run on many different systems. At the time there LOTS of different and incompatible programming platforms: Think 8080, Z80, 6502, 6800, DEC PDP-11, etc. It had NOTHING to do with not being willing to write a "real" compiler; the effort spent to create the Pascal compiler (for example) probably far exceeded the effort spent to implement the competing BASIC interpreters of the day. Sure, you could achieve the same result as bytecode by shipping source code for a portable language, and then have every machine recompile it. But: * Many 8-bit computers of the time could RUN programs that would take dozens of hours to recompile from scratch, with constant disk-flipping to get different programs. Users couldn't be expected to go through the agony of compiling just to run a program. The Apple ][, a common UCSD platform, often had 64KiB RAM and 1MHz clock rate (with many instructions taking 2-3 cycles), with 140K floppies. * Many compiler developers wanted to sell compilers separately, not give them away. They were willing to give away the runtime, though. * People could redevelop JUST the runtime - not a new compiler - and run programs. That made it MUCH easier to support new platforms. * Many developers did not want to release source code to users. More info: * http://en.wikipedia.org/wiki/UCSD_p-System * http://www.threedee.com/jcm/psystem/index.html There's nothing wrong with the bytecode concept, e.g., Java class files or .NET's equivalent. If you want easy portability of executables, it's STILL a reasonable approach. "Real" compilers tend to work the same way anyway; they often have a front-end that generates one or more intermediate forms that are easily viewed as a bytecode format, and then compile the intermediate form(s) into a final form. Whether or not having a standalone intermediate form is useful depends on your goals. --- David A. Wheeler _______________________________________________ Secure Coding mailing list (SC-L) SC-L@securecoding.org List information, subscriptions, etc - http://krvw.com/mailman/listinfo/sc-l List charter available at - http://www.securecoding.org/list/charter.php