4 ms·
It wasn't just the lack of a cast. (IIRC, you could work around that with variant records if you really had to, though it was really clumsy.) Another, unfixab
by AnimalMuppet 12y ago
It wasn't just the lack of a cast. (IIRC, you could work around that with variant records if you really had to, though it was really clumsy.)
Another, unfixable problem was that the size of an array was part of the type of the array. This meant that you couldn't ever access past the end of an array, which was good. It also meant that you could never have a variable-sized array - you couldn't even talk about the type of such a thing.
This meant that Pascal was completely unusable for writing, say, a memory manager (what type would you give to the return from an allocation)? But that's a low level problem. It also meant that Pascal couldn't be used for a numeric simulation where the size of your grid was a user-supplied runtime value.
Note that I am only talking about the original (Wirth/UCSD) Pascal. I believe that Turbo Pascal fixed the variable-sized array problem.
- pjmlp 12y agoThose problems were not part of the Pascal dialects. The largely ignored Extended Pascal ISO standard also had those issues fixed. The first Mac OS versions were written in Apple Pascal.
- agumonkey 12y agoI knew about Apple programs being in Pascal, but the whole OS ? did they resort to inline asm ?
- pjmlp 12y agoYes, they did use Assembly. When implementing an OS avoiding Assembly is impossible. Even if intrisics are used instead, they are just another way of using Assembly like instructions. There are lots of informations in this book, "Revolution in The Valley: The Insanely Great Story of How the Mac Was Made".
- agumonkey 12y agoYes indeed, I forgot about that. I wonder if there ever was a purely 'compiled' OS from some declarative form.
- saretired 12y agoThey used more than some assembly. Andy Hertzfeld: "But most of the Lisa code was written in the Pascal programming language. Since the Macintosh had much tighter memory constraints, we needed to write most of our system-oriented code in the most efficient way possible, using the native language of the processor, 68000 assembly language. Even so, we could still use Lisa code by hand translating the Pascal into assembly language. "We directly incorporated Quickdraw, Bill Atkinson's amazing bit-mapped graphics package, since it was already written mostly in assembly language. We also used the Lisa window and menu managers, which we recoded in assembly language from Bill's original Pascal, reducing the code size by a factor of two or so. Bill's lovely Pascal code was a model of clarity, so that was relatively easy to accomplish." Also, about half the LOC in MacPaint were assembly.
- pjmlp 12y agoBasic, Forth, C and Pascal were the Ruby and Python of the 80's home computers, both in compiler code quality and memory usage. Of course anything related to graphics programming would be written in pure Assembly code, so excuse me if I misused "Some".