This week we walk through the finer points of interpreters, compilers, just-in-time compilation, and how all this relates to our ability to communicate with extraterrestrials.
This is a great crash course on just-in-time compilers written by Lin Clark, who works in advanced development at Mozilla on Rust and Web Assembly. It references the film Arrival and kicked off our discussion on the podcast.
Paul talks about his first love, XSLT, and how that language actually foreshadowed a lot of what would become popular staples of modern programming languages.
Sara and Paul share their thoughts on what it takes to craft a new language as a programmer and why they have never embarked on this arduous intellectual adventure.
This brought to mind a well written essay from one of the creators of Redis, who is stepping back from managing the project to work on something new. Here is, in my opinion, a profound quote from that piece:
"I write code in order to express myself, and I consider what I code an artifact, rather than just something useful to get things done. I would say that what I write is useful just as a side effect, but my first goal is to make something that is, in some way, beautiful. In essence, I would rather be remembered as a bad artist than a good programmer."
Our lifeboat badge of the week goes to Farhan Amjad, who answered the question - How can I implement PageView in SwiftUI?
Sara Chipps You know, Paul, it's a surprise to me that you're an Emacs user because I once went to an Emacs meetup. And the one thing everyone at that meetup had in common is they were all very mad. [Ben chuckles]
Paul Ford Yeah, I know.
SC Unclear why.
Ben Popper Paul hides his rage well.
BP Nothing's more important than a great customer experience, but sometimes services get disrupted. xMatters helps teams resolve issues fast, before they impact customers. Learn why millions trust xMatters to keep their digital services up and running at xmatters.com/stack.
SC Hello and welcome back to the Stack Overflow podcast. I'm Sara Chipps.
PF It's good to be here.
SC Yeah! And I'm here with my cohosts, Paul and Ben. How's it going? Paul? Ben?
BP Hi Sara! Uh, pretty good.
PF Fine. Good.
BP Y'all I found a piece on Hacker News as I am one to do.
SC Mmm happens to the best of us.
BP Yeah, well, you know, it's funny cause I've been on Hacker News since I first got into covering tech. That was like where I went to learn about startups and venture capital. Now it's my cheat spot to go and easily pick up, Oh, this could be a cool story to talk about code. But uh, yeah, I went to Hacker News and there was an article there about how a Just-in-time compiler works. [mmm!] And the thing that really stood out to me that I loved was that they used the movie Arrival to sort of talk through interpreters and compilers and for someone who doesn't know how to code very well and certainly doesn't know how to, you know, how things go from human language to assembly language, that metaphor made a lot of sense. The whole process of how the human sort of learned to talk to the aliens in that movie I always really enjoyed. And yeah, I just, I just thought, I thought this article was very well written. We'll put it in the show notes.
PF Oh, meaning like Amy Adams holding up a sign that just has VIM commands on it. [Ben & Sara laugh]
BP Yeah. The squids only work in VIM.
SC To take this analogy even further. The different browsers are like the squids, but maybe like different nationalities of squid [mhm] that interpret the language just a little differently.
BP Can you guys walk me through a little bit of the basics of the difference between interpreter and compiler and then talk a little bit about, I dunno, what's been interesting in that world since we went from no web to web 1.0 to whatever it is we do these days.
PF Oh my God. I just sprouted a beard. [Ben laughs]
SC Yeah, so did I, strangely enough.
BP Can you do that for me in five minutes or less? [Ben laughs]
PF Um, let's, let's do the easy version. Sara, let, let, let's not get into cause it's painful once you get in there and it's a lot of arguing just like type systems. Well, let me, let me ask Sara, Sara, can anyone think of a language that is interpreted rather than compiled?
SC Yeah. Wait till you hear about transpilers, Ben.
PF Oh, Oh Sarah, did you ever look at the website Lambda the ultimate?
PF Uh, it's kinda what it sounds like. Like it is an extremely like academic programming website that was big for a while and, and sort of like captured a lot of the like deep type system anxiety. [woaah] And I mean, just the forums...
SC Man, I can only imagine.
PF I was learning about this stuff. So I still am literally terrified to talk about it [Ben laughs] because of how angry people used to get about, you know, Haskell.
SC That's all you have to say.
PF But it's a good article here that people should read.
BP Yeah. Along with, um, talking about the movie Arrival, which I thought was good. They did do a really good job of explaining the difference between an interpreter and a compiler. Like what the trade offs are between the two of them. And then, yeah, I learned about hot paths for the first time. And I like that part seemed very intuitive in some ways, you know, one of these does it in real time, but has to repeat itself. One of these does it after the fact, but like makes a finished product that, you know, you can use over and over again. And then if you have these hot paths, you can start to say, okay, this part of code instead of running the interpreter over and over again, I guess as what you're talking about, Paul, right? Like you are compiling pieces that you're going to use repeatedly and interpreting the stuff that's either used once or being still being written live.
PF Well, this is the great struggle of computer science is how much should the computer know about what it's doing [mmm] or should it just do it dammit! [Ben chuckles] And so like, you know, this, when you inspect the element that used to, or you know, used to be you viewed source, and then you figured out what all that was doing when the browser.
SC Yeah. The person that wrote this article, Lynn Clark works at Advance development at Mozilla with a focus on Rust and WebAssembly and all of that makes sense, right. In order to work on Rust and WebAssembly, you have to have a pretty robust understanding of the difference between interpreters and compilers and how they work.
PF That is the stuff like that's the deep down stuff.
SC It definitely is.
PF Anyway. I've always asked, have you ever written a language or want to during the language Sara?
SC No! No. I've never even wanted to, which I know is something that you have.
PF Well I'm just like, I'm actually not interested in actual programming languages, still deep down in my heart I still am always fascinated by markup and markdown and various kinds of syntaxes that you can use to get lots and lots of impact. Cause I think the web got into my brain when I was like, you know, 20 years old and I'm like, my God, you can do so much with just a few little tags. Like what else could you do? And then, I don't know, we probably haven't talked about it before. Or if we have like my first serious language was XSLT, which was Pearl and XSLT, that ages me. Right. But like XSLT was an attempt, [oh yeah] it was grim. It was a purely functional language in XML. So...
SC Exactly, yup. And it was like just wildly and it was like interpreted XML. Right? You could come up with your own mod, nodes.
PF Oh yeah. Oh yeah. I mean, it was actually what's wild about it is it did a lot of like the future facing type driven pattern, matching purely functional tree transformation stuff that we, everybody thinks is really cool, but it did it in the worst, worst syntax possible for programming. [Ben laughs] And, and so, you know, so it's, it's very strange for me because all of the things that the cool kids care about were embedded in this utter loser of language that let's be clear has millions of users. And I loved very much.
SC At the time it was very cool though.
PF It was cool. What it taught me was, was to think about the document instead of as like a magical thing or as like a weird sort of word processing document. It taught me to see it as a tree of data and that the job of the computer was to transform the tree. And once you transform that tree, you could transform it into five other trees. And there's a great Alan Perlis quote in his epigrams on programming. It's something like it's better to have one data structure and a hundred functions that operate on it versus a hundred data structures, you know, and like one function to deal with them. And that sort of sticks in my head. Like, can you, what's the most value you can get out of your data? What are, what are the things that you can do? And actually, I think the heart of that now is schema design. Like that's one of the reasons why everybody's gone hard on like graphQL and gotten back into Postgres is because then you can really express, expressing what the data is, is such a big part of the job.
SC When you do this for long enough, the schema design stuff is so funny to me because I see it. And I'm like, Oh, so you denormalize databases and now you're just someone needs to normalize it again. That makes sense. [mhm] Yeah. That drives me nuts. The reason why I never wanted to write a language and because one thing I've noticed about friends and folks I know that have written languages is it really gets to the core of the challenge of a developer because often people are like, if I write a good language that is optimized in every way, everyone will want to use it. And it'll be huge, but that's like the wall you come up against as a developer. Because I think that naturally we undervalue how important the sales and marketing arm, right? So like, if you are not talented at sales and marketing, you can write the best language in the world. But if you don't know how to get it out to people, and that's what I've seen, a lot of people run into that write their on languages. It's like, I wrote this amazing language. It does X, Y, and Z really well, but no one knows about it.
PF Oh yeah, no, there's thousands and thousands and thousands. I mean, I think it's, it's an interesting exercise. I would never. The amount of intellectual effort to get even a tiny amount of buy-in at that level is unbelievably high, right? Like you're just, you're gonna, that has gotta be something you truly, truly want in your life.
BP This brings up an interesting article that I saw last week, which again, not knowing a ton about code, but like something that I can relate to as a human. It was somebody I believe they were saying goodbye to Redis and they were one of the creators. And they were sort of saying like, I've spent 10 years working on this project. I'm so glad that after creating it, it became something that people all over the world wanted to use. Like you were saying, you know, whether it's marketing or I guess, skill in creating language or just luck, you know, your timing with other technologies and ways of working they're coming online and happened to become really popular. And the person is saying, I feel really privileged to have been the originator of something that went on to be so widely used. But I got into this because I liked the creation step and I don't want to do the managing the, you know, moderating, the work of keeping the community going. So I'm going to step back and let the community run itself and maybe try to create something from scratch. Like I, the creator was writing sort of saying, like, I feel like my happy place is more in the art and the inspiration at the beginning, not the middle management once it's all huge.
PF I mean, Redis has had its share of drama. Like all big open source projects. That is to be commended is to go, you know, what the hell with it? I'm going to go do some new stuff. And I hope you guys can really keep this thing rolling. Let's call it what it is. That is a big deal. And I think what happens is that everybody's like, Oh, he's taking his marbles and going home, but that's open source.
SC Yeah. I think it's mature. It's like a, it's like understanding your limits or understanding what gives you energy. It's like a level of career maturity.
BP Here's the money quote: ''I write code in order to express myself. And I consider what I code an artifact rather than just something useful to get things done. I would say that what I write it's useful just as a side effect. And my first goal is to make something that is in some way beautiful. In essence, I would rather be remembered as a bad artist than a good programmer.''
SC Remembered as a bad artists than a good programmer. Fascinating!
PF Yeah. I bet I can be remembered as both a bad artist and a bad programmer. [Ben laughs]
SC So one thing I'd love to talk about with y'all is some really interesting insights from the developer survey about the most popular development environments. So fascinating to me and not actually, it's a big surprise as how quickly this happened, Visual Studio Code at the top.
PF Right? So not Visual Studio, but like the...
SC Visual Studio Code. Yeah, yeah.
PF The open one. Yeah.
SC Which VS Code is really been really fascinating to see, because one thing I have just seen over the past few years is my friends that don't write Microsoft. Like don't write C sharp don't aren't centered around Microsoft technologies using Visual Studio code. And just saying that they love it. And what's interesting though, is Atom, the IDE from GitHub in the beginning, I heard the same thing about Atom from people that they loved Atom, and it was amazing, but then Visual Studio Code came out of nowhere and just kind of surpassed it.
PF I mean, it's so good that code server technology underneath with all the, you know, it's just, they're good at it. They're so good at IntelliSense. And you're just like, Oh, okay, I'll do it the way you told me to do it. It's fricking excellent.
BP Sara, on this, on this particular one that you sent us, are you allowed to choose more than one because I'm seeing percentages here. [Paul laughs]
PF I hope so.
SC Yes. You are allowed to choose more than one.
BP Okay. So VS Code and Visual Studio together make up the top two at like, you know, quite a bit 80% of people.
SC 80%, Notepad++ that's a head scratcher to me. Do you know any, I don't know. Cause it just because I don't know anyone using Notepad++. Do you?
PF Notepad++ is just something that has had millions of users for probably like a decade plus. [yeah, yeah] And it's just, it's just entrenched and you know, same with IntelliJ, like actually IntelliJ for Java has been around for a while. Like I'm going to bet, like, you know, there's some language and some framework that Notepad++ is really well aligned with. Vim, no surprise. Although 25 percent Vim versus Emacs?!
SC Yeah. I was about to say. I'm so glad we've decided Vim versus Emacs and Vim has won! Look at that.
PF I got to give it to you. Vim won. That's it. It's over.
SC Paul, what made you an Emacs person?
PF Uh, it started in college. It was a good, just a good text editor. And I read about it and I was like, Oh, I should try that out. You know, it's like anything. What's the thing that has kept me on Emacs is a thing called org mode. That is the, to do list manager slash composition environment for just about anything. And boy, is it powerful. It's just really, really good. And it, what it lets me do actually is my to do list can easily evolve into a written piece. Like I can write an outline to structured to do lists that I can then write out and then I can run a command and have it as a word doc and send it over to an editor. And so like that process with kind of basic to do done management built in. Ooh, it's good. But no, I mean just old fingers that remember how to do the things.
BP [Ben chuckles] Sara, I want to read you something. It seems like we started asking this question maybe in 2016, I couldn't find it in 2015, but back in 2016, Notepad++ was the top response followed by Visual Studio, Sublime Text, VIM, Eclipse, IntelliJ. So it looked totally different.
SC Yeah. Visual Studio Code, Atom, all those came, Sublime Text. Light Table. People are still using Light Table
PF Light Table. Light Table's in there. It's very, very, very, very much at the end 0.2%, right? So. [yeah] Light Table's cool. People should. But I, I honestly like the winner here is Visual Studio Code.
SC It really is.
PF That thing came out and it's coming for everybody. Right? Like it's just, it's, it's 50% where a couple years ago it was 0%. Boy, is it good.
SC Yeah. I mean I use Vim and Visual Studio Code exclusively.
BP Five years ago, four years ago, it was 7.2%. And now they make up together, you know, 80% of respondents say they're, they're using it. So pretty wild changed since 2016.
BP Alright. Yeah. It's that time of the episode where we read a lifeboat and say our goodbyes, I'm gonna kick it off. So this time we are giving a shout out to Farhan Amjad awarded July 1st, how to implement page view in the Swift UI, I'm new to Swift UI. I have three views and I want them in a page view. I want to move each view by swipe like a page view. And I want the little dots to indicate in which view I'm in. That was the question from Jeeva Tamil back in October of 19. So shout out to the answer here about page control and page view from our friend Farhan Amjad for getting a life boat.
PF Good lifeboatin'!
SC Great, great lifeboat.
BP Alright. I'm Ben Popper, director of content here at Stack Overflow. And you can find me on Twitter @BenPopper.
SC And I'm Sarah Chipps. You can find me on GitHub @SaraJo.
PF I'm Paul Ford. I am a friend to Stack Overflow users everywhere and check out my software company where I'm the cofounder postlight.com.