Sean Parent

C was never a particularly elegant language. That's true. Pascal by comparison is a very elegant language. C was always difficult to parse compared to Pascal. So there were a lot of things working against it. But one of the things working for it is C from the get-go tended to have direct compilers targeting the assembly language of whatever machine you were working on, where Pascal still, for the most part, relied on P code with a few exceptions. Apple had a compiler to 68K, but almost everybody else was running through P code. And so Pascal was viewed as being slow and interpreted. And the whole object Pascal thing was viewed as being Apple's Apple's extension. And so it was not, did not get wide use outside of the Apple ecosystem.

Conor

Welcome to ADSP The Podcast, episode 162, recorded on December 12, 2023. My name is Connor, and today with my co-host Bryce, we continue our conversation with Sean Parent. And in this episode, chat with him about the history of Pascal, Pascal versus C, other Nicholas Virth programming languages, and more. We've now skipped ahead over Zach. Happy holidays. You know, the holidays have passed, and I think it should be right before New Year's. What do you call that? With respect to the what are we, Julian Gregorian calendar? One of the two. Happy New Year's or Happy New Year's Eve, if you're listening to this now. And the the original reason that we were bringing Sean back is we will link this at the top of the show notes to this episode, is we did a series of conversations with Jonathan O'Connor where we were talking about a plethora of stuff, but a couple of the episodes focused on Pascal versus Ada versus C. And there was a bunch of stuff that we chatted about. But Sean, you ended up replying to, I believe it was the tweet on episode 154, which was, I think, like part two or part three of that talk. And I'm not going to read out everything because it was about three or four tweets in a row, but you mentioned a bunch of stuff that didn't get mentioned in that conversation. You know, if I if I peruse through this tweet, it's mentioning the Apple Lisa and Mac OS were written in a combination of Pascal and 68K. Um and then you mention a bunch of different books, a bunch of different computers. And I'll probably just leave it there and just throw it over to you. And you can start wherever you want to start with the things that we missed and that you were sort of screaming in your head, how come they're not mentioning this? How come they're not mentioning this? And uh that's what the next, you know, either part two or part three, or maybe do one part uh of this conversation will be.

Sean Parent

Yeah, so combination of that, and then you then I was listening to uh uh uh software unscripted and and you made uh uh a guest appearance there, Connor, on on that podcast. And uh yeah, you mentioned that you were born, I think, in 1990, if that's correct. That is correct, yes. Yeah, yeah, which just made me feel very old because it made me hope I joined Apple three years before you were born.

Conor

Um I mean I was we were interviewing on my other podcast at Raycast, uh Brian Ellingsgard, who is 18, which means that he was born in 2005.

Bryce

So, you know, I don't that's I didn't know. People shouldn't be that young.

Conor

I know. So like I didn't know how young he was. And then when he said he was 18, I was like, oh god, that may so if you're feeling old about me and I'm feeling old about Brian, you know, it's just this uh vicious, vicious feedback loop here.

Sean Parent

Yeah, yeah, and like like not not knowing kind of you know Pascal and and that history was was interesting. Pascal had a had a had a uh a pretty significant heyday, and even going all the way back to the Apple II, uh uh there was uh uh uh an implementation of UCSD Pascal, which if you wanted to you know program you know a 68k processor, which was the old Apple II, was a a uh uh uh uh uh an 8-bit processor. So even doing you know 16-bit arithmetic was a challenge. Uh Steve Wozniak wrote uh something called Suite 16, which was kind of uh uh a pseudo 16-bit assembly language uh uh that executed in in uh 6502 uh as uh as a way to write 16-bit assembly language easier. So Pascal had a bit of a heyday at that time, and there was an implementation um from uh University of California, San Diego, UCSD.

Conor

That's that's what I was thinking that UCSD stood for, but I was like, that can't be I must be that must be some other acronym, and that's the only one I know, so that's what I'm thinking of. Uh but that's it is what it stood for.

Sean Parent

Yeah. So so an implementation came out of there, and and it was uh based off of something called P code, where P-code is basically a uh uh bytecode that's easily interpreted. Um so the idea with UCSD Pascal was you could it was kind of you know pre-Java Java. It was you you could compile uh your Pascal code down to Pcode, and then you could run that P-code any place that had a P-code interpreter, and building a P-code interpreter was dead simple. Um so it meant that you could write Pascal code and have it run basically anywhere. So Pascal itself became kind of the moral equivalent to what we would now think of as Python, which is kind of an application language. If you needed to write software and you weren't, you know, to solve a problem, right? Use it using uh a programming language as an app, right? So you're writing software to solve a problem as opposed to building a product. Uh, Pascal got got an awful lot lot of use in in that environment. And it also became a great teaching language. And then uh uh it started to bleed into system languages. So the the original uh LISA was written, the operating system itself was written in a combination of Pascal compiled to 68,000 and uh 68k assembly language. And then uh Larry Tesla, who had come out of Xerox Park, worked with Nicholas Wirth, who who created Pascal uh to define object Pascal, and that kind of became the language of choice for writing applications on the on the LISA. And that same basic model moved into the early Macintosh. So the initial Macintosh, the operating system, was written in the combination of 68K assembly language and Pascal, and then most applications written on top of the early Macintoshes were written in Object Pascal. You know, object Pascal eventually morphed into Delphi. So that's there's a there's a direct lineage there. But what happened was Unix took root in universities and kind of displaced uh mini computer operating systems like Vax VMS got eventually displaced with Unix distributions. And Unix was very much built around uh the C language. And so C started getting taught in universities and displaced Pascal as a language of choice for a teaching language. And there became this large ecosystem of developer tooling uh built in C. And so there became all these external pressures to move towards C. So eventually, in you know kind of early 90s time frame, Apple transitioned uh Mac development from Pascal to C. And Photoshop was originally written in Object Pascal in 1990, and let's see, probably around 92, I would guess. Uh, Photoshop was ported from Object Pascal to C. And that was back in C front days, where it was Bjarna's compiler that compiled C code into C, and then you compile a C code into your machine code.

Conor

And wait, so so you said that this m shift was just happening because Unix was gaining popularity and Unix was associated with C. So and you mentioned that C started to get taught in universities because of this. But at the same time, Pascal and Object Pascal or versions of Pascal were also being taught. So it was just momentum that like Unix and C had more momentum than the family of Pascal languages?

Sean Parent

Yeah, it was it was largely just momentum. It got to the point where you know it was like, well, I could write this in Pascal, but look, there's all these tools that do this in C. And you start hiring people, and it became hard to hire somebody who knew Pascal. They knew C. So there was this momentum shift. And and from kind of you know building an operating system, there were certain things that were you know a little bit easier to express in C, right? It was just easier to circumvent the type system and kind of do whatever you wanted. Although, you know, in Pascal, Apple would do that by just dropping into 68K assembly language and and and writing little snippets like that where C was not sufficient. Uh but you know, for a while there it was very unclear that C was never a particularly elegant language. Uh Pascal by comparison is a very elegant language. Uh C was always difficult to parse compared to Pascal. Uh so there were there were a lot of things working against it. But one of the things working for it is C from the get-go tended to have direct compilers targeting the assembly language of whatever machine you were working on, where Pascal still, for the most part, relied on P code with a few exceptions. Apple had a compiler to 68K, uh, but almost everybody else was running through P code, and so Pascal was viewed as being slow and interpreted. And the whole object Pascal thing was viewed as being Apple's Apple's extension, and so it was not, did not get wide use outside of the Apple ecosystem.

Bryce

You know, talking about P code reminds me uh that, and this is this is uh going to be embarrassing for Connor and I. During our previous discussion, Connor, I don't think we talked about the fact that I'm pretty certain that the book, ADSP, algorithms plus data structures equals programs, is largely in Pascal. And in fact, I I re I believe that my original encounter with P code was that there's a like a sim they they they write like a little Pascal compiler in the book with a very slimmed down version of the VM. Um and I only just now remember so clearly neither of us have read the book that recently.

Conor

Well, I mean, it because of the conversation with Jonathan, I did go out immediately after recording that. I bought a hard copy book and it's sitting on my shelf now. And because it was it was when he said that yes, it's considered like a teaching book for Pascal, I was like, oh, that's you know clearly we haven't read it, but like we didn't even know the basics of what I thought this book was like a generic just kind of data structures and algorithms book. But but yes, so at some point we will read it. I did not know that about the P code though.

Bryce

Um Yeah, yeah, I think I think um because I I I seem to recall that like the Turbo Pascal compiler was like inspired by the the little teaching compiler that was in the ADSP book.

Sean Parent

Yeah, there was uh Turbo Pascal first appeared on well, I was gonna say Windows, but DOS, I think, would be correct. Uh so on Microsoft's platform. And yeah, TurboPascal was just an amazing, you know, little IDE and compiler that was just blazing fast and and was not P code based, went straight to uh uh 68k assembly. Um Apple in the early Mac days, they had an they had their Apple compiler, but they also had something called Apple Pascal, which was the same name as as the Pascal that Apple had on Apple II. But Apple Pascal on a Mac was an interpreted Pascal that was very much centered around kind of you know programming as as an application, right? As opposed to to programming an application. So same way you would use use Python today, right? You just want to want to solve a problem. And it was was you know very slick environment and debugging environment, uh very easy to use, uh very limited. I think in your talk, somebody said like you could only have one file for a Pascal program. Uh uh not true, but that was true in Apple Pascal. Um uh and that file itself could only be 32k in size. And uh I actually wrote a school project in uh in Pascal and ended up writing another tool in compiled Pascal that would process my my Pascal uh to minify it so that because I had to turn in the school project in Apple Pascal and so that I could fit more in the 32K. And so I turned in two listings. One was the unminified code, and then one was the code that actually ran, which was was greatly reduced.

Conor

And probably a lot less readable.

Sean Parent

And a lot less readable. Also included there was an escape patch so you could execute assembly language, and so there were sections of code where I just hand wrote them in assembly language and escape from Pascal to assembly language. So not completely legit, but you know, it was it was interesting. Uh uh, I think a lot of ideas from Apple Pascal then uh got carried over into uh uh and turbo Pascal, into ThinkC, and then into MetroWorks uh Code Warrior. Uh I think the other thing that damaged Pascal was Nicholas Wirt didn't, you know, he did Pascal and then he did Object Pascal, and then from what he learned from Object Pascal, he created modula two, or well, first modula and then modula two, and then then created Oberon. And so, you know, he was a university guy, and so he was kind of creating this stream of little languages, and so abandoning his his previous work. And so I think that ended up damaging things, right? There got to be the point where you know I I did work, actually shipped a product that was partially written in modulo two. Uh before MetroWorks did Code Warrior, Greg Galinos wrote uh modula two compiler for Mac. I probably still have someplace here my uh my modulo two book. People were doing, well, is it going to be modulo two next? Is it gonna be, you know, are we doing modulo two? Are we doing object Pascal? Oh wait, now we're doing Oberon? What's going on? And so so just that lineage kind of confused the marketplace, and and C and C had this much more straightforward story.

Conor

That is uh it's incredibly reminiscent of what I mean, I've told this story a couple times on the podcast of what Arthur Whitney has done with the all the different K languages that he's written, that he'll finish with one, even more aggressively will delete it, completely clear all of you know the remnants of it off his workstation or laptop, and then move on to the next thing. And yeah, like that, there's definitely that same kind of effect on the community that's using it. You know, people, is K6 gonna be the final one? Is K7 is there gonna be another one? And I think every every time that a new one is created, people are more and more cautious to like move to the next one, or do we just keep using what we have? Yeah, and I wonder, because the next name that comes to mind is on our Andrew Hausberg out of Microsoft, but he's almost the opposite of that, has worked on a ton of different, like majorly successful languages, but has not it hasn't been like you know, they he sh he made sure that the community was gonna you know survive and continue to thrive and then just moved on to the next project, uh which I guess is uh you know, for any aspiring programming language creators, do what Halsberg did and not what not what uh Virth did or Whitney. Or maybe they're work maybe you know Whitney's working towards uh a final one language to rule them all, in which case uh there'll be a bit of an excitement around that. But I'd had no idea that that was kind of the reputation around uh what Verth was doing.

Sean Parent

Yeah, yeah, I've often thought if you take a compiler class in school, you basically learn the dragon book, and which is a a great book, but unless you're going to end up building compilers out of school, which very few people will, I think it's it's overkill. And and Nicholas Wirth's languages and and his compiler uh books uh are much simpler. The way Nicholas Wirth always built a language, I call it LL1 to the bottom, which is he would define an LL1 grammar, which is you know a very simple recursive descent grammar with no backtracking. If you if you you know if you don't get success on the next token, then your your code is wrong. And his compilers all generated code straight from the parser. He never built an AST. Uh so he would compile straight from the parser into P code or or or into assembly language. And so it's it's a much simpler approach if you're if you want to build uh a quick compiler one-off. Uh it's really easy to build a little stack machine interpreter and then build a compiler that's recursive descent, and you just generate the code for your own stack machine straight out of your parser, and you don't deal with ASTs and you don't deal with extra complexity.

Bryce

But is is um is a Lisp really that is like it's scheme in the Dragon Book, right?

Sean Parent

Uh yeah, I believe it is scheme in the Dragon Book.

Bryce

Is it really that much harder to parse? I I mean I I do think they build an AST, but in that book, but is it really that much harder to parse?

Sean Parent

Um no, it's not that the the the the parser in that language is is that much simpler. It's just that they go through like all the steps of building a compiler, and it's like you build your AST and then you do passes on it for optimizers, and you look the Dragon Book is a thick book, and nobody makes it through the Dragon Book in a quarter. I mean, come on, you're not you're not actually doing that. Uh where I can't remember the name for Wirth's book, but it's it's a small, small book. Uh and if you look, like you know, Nicholas Wirth built, I think I mentioned it on Twitter, um, a machine called the Lilith, which was basically a modula two machine. What do you mean by he built a machine? Uh I mean they were manufacturing and you could order a Lilith, and you know, like you could order an Apple II, you could order a Lilith. It was an expensive machine. And did he design the chip or he just built it was just like a it was a combination of uh doing the chip design because it was uh the processor on it basically executed the bytecode coming out of the modulo 2 compiler directly. And so it had its its own its own custom CPU, its own custom hardware, it had a portrait display, it had its own modulo 2 based operating system, kind of a window-based based operating system. Quite an impressive feat at the time. You can you can look up, you can probably find emulators someplace to run run a Lilith. You know, at the time, it's you know, I salivated over these things. It was like, oh, I really want a Lilith computer, but no possible way that I could afford one. You basically needed to be you know in research at a university with some kind of government funding to get a Lilith. But yeah, it was you know one of those those dead ends in the uh in the evolution of of of hardware and software.

Bryce

But that's it it's an interesting era because these days you could not, I think, create a uh create your own machine at the same scale.

Sean Parent

You need to be a lot of people kind of do now with FPGAs. So so you know, I I kind of think you could these days with uh you could basically build your own processor FPGAs and build custom ASICs. The only place where I see people doing that is kind of emulating old game hardware.

Bryce

Aaron Powell But you y you don't think that uh that that era in the past was a golden era of hardware and software design, and that we're now in a much more homogenized um era and an era where um the certainly the high end of chips is um only for are only the high end or let me put it in the way, the high end of computers today, um uh and I don't mean like the most powerful computers, but like you know, the best computers, you know, the the the phone computers in your phone that are in your laptop, you know, even something like the Nintendo Switch, um, those are produced by gigantic corporations and have huge, huge amounts of investment um to go into them um to produce them, whereas, you know, back in the the seventies and the eighties, um you could uh you you could create a a thing that was a good thing at a much smaller a much smaller scale. Not quite maybe in in in your your garage, but certainly close.

Sean Parent

It's interesting in that you know, I don't think Well it's somewhat the same. It's like, you know, Steve and Steve, right, created the the Apple I, you know, famously in the garage, and you know, did the work for the Apple II as well, um, uh very small scale. And there's no way that you would do that today and compete with with a Mac or a Windows box. There's just no way. But at the same time, for them, they were creating something that ultimately would compete with you know uh uh minis and mainframes, and there was no way for them to directly compete with that. And surprisingly, the barrier to do like small entry-level hardware these days is really low. I mean, if you look at uh small startups like uh uh uh Tilt 5, which just does uh you know an amazing setup for for uh kind of augmented reality for uh board games, which is is very cool. And so it's little PICO projectors in glasses, uh Jerry L Ellsworth's work. Absolutely brilliant hardware. And is basically you know, one woman, a small company, a small team who's who's who's doing uh this this relatively inexpensive custom hardware.

Bryce

I I guess you have a I guess you have a fair point. Um Yeah.

Sean Parent

And so, you know, and you see like one-off little consumer products all over the place. Will somebody build an entry-level laptop or OS or something that eventually displaces Mac and Windows? I don't know, maybe. You know, I think it's it's doable. Um it's just you're not gonna start with a head-on attack. You're gonna start building something that that Apple and Microsoft view as a as a non-threat toy in the same way that that DEC viewed the Apple II as a toy, you know, not anything that would be at all competitive with them ever.

Conor

Have you have you tried this? I because I had never heard of Tilt V. And when you mentioned AR board games, I have always thought that uh I've only ever done one DD campaign, Dungeons and Dragons, for the 1% of our audience that doesn't know what that refers to. And uh it was cool, but it was done virtually during the pandemic with my siblings and siblings' partners, and it was uh very cool, but it was done through like a 2D online, you know, like you're going through the board and whatnot. And it's I think you get a lot more out of having like a real board, or if you go to a game store and you have one of those sort of like, you know, uh not battlefields or whatever.

Bryce

Have you have you have you ever played DD at a at a game store?

Conor

No, but I have been to uh game stores.

Bryce

Trust me, having the online thing to like keep track of all the state is actually very convenient.

Conor

Okay, but my point, my point being though, is regardless of if you're doing it in person with a dungeon master that is expert at you know moving things around, making spatially aware stuff, or you're doing it on this 2D thing, the real like first world-class experience that you want is this kind of AR thing where the the dungeon master has, you know, ahead of the campaign, gone forward, set this up of the different corners that you could the different directions you could go. And as the campaign unfolds, you're just like you don't have to like, oh, the mist comes over, you know. Sure, the the dungeon master can narrate that, but you know, with the swoosh of a hand, you know, the mist actually like appears on this, and you could do it virtually. Everyone has a set of glasses, you know, they're just staring at whatever table.

Bryce

And so I want to use my imagination. It's like reading a book. So, like, you know, movies are nice, but sometimes one wants to read a book.

Conor

All right, Bryce is not invite uh invited to the future uh Dungeons and Dragons campaign that I will have using this Tilt 5 technology. But I I went to this site, and as soon as you said that, I was like, wait, is there a company that already has the hardware to do this? And sure enough, they've got like a little a demo of it doesn't show a DD campaign, but exactly this kind of thing where everyone's got a little controller and they're playing these little fun games. Anyways, this is a long-winded of like this is something that's been in the back of my head of like the this future technology would be awesome. Have you used this and do you know if like it's actually at the state where you can do this kind of stuff?

Sean Parent

Oh yeah. So so this is the tilt five stuff is actually Jerry's, you know, second generation.

Conor

Be sure to tune in next year when we finish part three of our three-part conversation with Sean Parent about Tilt Five, augmented reality, and more. And be sure to check your show notes either in your podcast app or at adspthepodcast.com for links to anything we mentioned in today's episode, as well as a link to a GitHub discussion where you can leave comments, thoughts, and questions. Thanks for listening. We hope you enjoyed and have a great day.

Bryce

Low quality, high quality, that is the tagline of our podcast.

Conor

That's not the tagline. Our tagline is chaos with sprinkles of information.