Creator of Scala: Comparing Languages And How AI Will Impact Them | Martin Odersky

31 Aug 2026 · 58 min · 26 chapters

Ask about this episode

Ask anything about it. ChatGPT or Claude reads this page and answers with the times it was said.

Connect VO and ask about every podcast you hear, including the moments you saved. Add to ChatGPT · Add to Claude

In short

Martin Odersky (Scala creator) discusses functional vs imperative programming, why Scala is a synthesis of OO and functional ideas, how languages should evolve under AI code generation, and compares Scala with Rust, Go, Zig, Python, and other languages.

Guest backgrounds

Martin Odersky is the creator of Scala; he previously worked on a Java compiler and on PISA with Phil Wadler. He has an academic background (PhD) and later focuses on language design and research.

Key claims

AI-generated code will make human review impossible, so programming languages must shift toward stronger interfaces and types as contracts between humans and AI. Types must become more precise and harder to undermine. Memory safety is “table stakes,” but capability-based safety (preventing capability escape/forgery) is also needed. Ten years out, he expects fewer but more highly qualified software engineers.

Notable examples

Twitter adopted Scala after Ruby proved unreliable; Scala runs on JVM bytecode for fast loading/REPL; Scala’s inline mechanism is compile-time and type-checked before codegen; capability example uses scoped file access; he cites proof-oriented functional languages like Coq/Lean/ROC.

Written by AI. May contain mistakes. Listen to the episode to check what was said.

Chapters

Tap a time to open that second in VO

Understanding Functional Programming

0:45 to 2:41

Explore the principles of functional programming and its benefits over imperative programming.

“So functional programming is programming with values.”

The Learning Curve of Functional Programming

2:41 to 4:53

Discuss the challenges of transitioning from imperative to functional programming and its advantages.

“but you can't change a coefficient at 0.3 at the third coefficient and pretend it's the same polynomial.”

The Unique Aspects of Scala

4:53 to 7:14

Discover what sets Scala apart as a functional and object-oriented language.

“It's not quite clear how significant they are.”

Comparing Programming Languages

7:14 to 10:12

Evaluate the pros and cons of Rust, Go, and Scala in programming environments.

“So you can write really beautiful programs in this combination.”

Garbage Collection and Memory Management

10:12 to 12:39

Examine memory management strategies in Scala, Rust, and Zig, focusing on garbage collection.

“I believe right now Rust is actually overused because a lot of people push Rust for things higher up in the stack where a garbage collector is fine, but essentially you still want to write code without.”

Inlining and Compilation Techniques

12:39 to 14:00

Understand the concept of inlining in programming languages and its implications for optimization.

“So right now I would say you use the garbage collector Scala, yeah.”

Inlining Mechanisms in Scala

14:00 to 17:09

Learn about the inlining mechanism in Scala and how it optimizes function calls.

“So Zik, I believe, is much better because the inlining mechanism is much saner.”

Comparing Scala and Python

17:10 to 19:59

Explore the trade-offs between Scala and Python, including type systems and language features.

“And so the gap is closing in that sense.”

Influences on Scala's Design

20:00 to 22:25

Discover the historical influences on Scala, including Java, OCaml, and Haskell.

“So now Java is, of course, even more useful, but also a lot bigger than what it was at the time.”

Scala on the JVM

22:26 to 23:50

Understand how Scala compiles to Java bytecode and its implications for interoperation.

“So the JVM is essentially defined by its bytecode.”
Show all 26 chapters

The Scala Compilation Process

25:01 to 28:00

Gain insights into the Scala compilation process and advantages of JVM integration.

“I have to compile it and then I have some Java byte code and then I call, I don't know, JVM and I pass in this bytecode and it just works.”

The Development of Expresso Compiler

28:00 to 29:24

Learn about the development and complexities of the Expresso compiler and its libraries.

“that has other nightmares, right, that every run is different and how do you even figure out what goes wrong.”

Twitter's Adoption of Scala

29:24 to 31:00

Discover the story behind Twitter's decision to adopt Scala over other languages.

“How did they choose such an obscure language at that time?”

AI's Impact on Programming Languages

31:00 to 34:08

Explore the existential crisis in programming languages due to AI-generated code.

“I mentioned a little bit that AI is kind of generating a lot of code.”

Capability Systems in Programming

34:08 to 36:26

Understand how capability systems can enhance AI and programming language safety.

“Like, they will not be able to leak my API keys or my email or do other things, right?”

Memory Safety in Programming Languages

36:26 to 39:21

Learn about the importance of memory safety and its implications for various programming languages.

“Can you explain what that might look like or maybe give an example?”

Future of Programming and AI Integration

39:21 to 42:00

Examine how programming languages might evolve with AI and the significance of formal specifications.

“Nobody sort of thought that it was possible before Rust came.”

The Future of AI in Programming

42:00 to 44:35

Explore how AI will change programming languages and the role of software engineers.

“than to write a program or sometimes even harder.”

Learning Multiple Programming Languages

44:35 to 46:36

Recommendations for programming languages to learn for broader understanding.

“and I wanted to know, aside from Scala, what are the top programming languages you would recommend people learn to expand their mind?”

Career Choices in Academia vs. Industry

46:36 to 48:27

Discussing the reasons for choosing academia over industry and its long-term benefits.

“And in fact, the courses I taught on Coursera and DPFL are based quite a lot.”

Reflections on Scala's Development

48:27 to 53:00

Insights into the successes and challenges faced in Scala's journey and community dynamics.

“What are some things that went well or things that didn't go well and maybe some learnings you could share?”

Unexpected Success of Scala

53:00 to 55:43

Understanding why Scala became successful and its unique features that led to its adoption.

“And languages like Rust or Haskell, they're more discriminating.”

Advice for Aspiring Programmers

55:43 to 56:00

Encouragement for taking risks and embracing unconventional paths in programming careers.

“Looking back on your career, when you just graduated college and kind of started your career, knowing what you know today, what advice would you give your younger self?”

Embracing Non-Conformity in Technology

56:00 to 56:31

Learn about the importance of being non-conformist in tech pursuits.

“If you take a fancy to do something wild and crazy, technically take the time to do it and do it.”

Podcast Guest Suggestions and Interactions

56:31 to 56:56

Discover how audience suggestions shape future podcast guests.

“Guests like Barbara Liskov, Mike Stonebreaker, Mark Brooker, these were all people that I brought on because someone left a comment.”

Ergonomic Keyboard Project Update

56:56 to 57:25

Get an update on the launch and progress of an ergonomic keyboard project.

“I'm working on building the ergonomic keyboard that I wish existed.”
Hear the part that matters, and keep it.Open this episode in VO. Double tap your headphones to save a moment as you listen.
Get VO free

Transcript

Automatic transcript. May contain errors.

0:00We are at a moment where it's essentially very dangerous that we lose control as humans.

0:05Martin Odersky:This is Martin Odersky, the creator of Scala, and I asked him all about programming languages and how they're going to change in the future. I believe right now Rust is actually overused. So Zik, I believe, is much better because the inlining mechanism is much saner. This pisses off both communities and they promptly declare jihad. If the code is AI generated, then the focus has to go elsewhere. And I think the focus will go to the interfaces and to the types. Ten years from now, do you think there will be more software engineers than today or less? Here's the full episode.

0:44Martin Odersky:What is functional programming and why should an imperative programmer care about the functional way of programming? So functional programming is programming with values. So you don't have state that changes, like new variable variables that change or arrays that change. You have values and you have functions, and the functions transform these values into other values. So it's a very restricted form of programming, and most real functional programming languages are impure in the sense that, yes, of course, at some point you have to touch state and change things and write to standard out and things like that.

1:24But the idea is to do that sort of very late, so to have the largest part of your program represented as values and functions that transform values. And the benefit you get from that is essentially much better predictability and fewer bugs because these side effects to, let's say, a global variable or a field and some object graph or things like that, they can really trip you up. They can essentially get an undocumented effect of your function, so it's not reflected anywhere typically, but maybe you have a comment if things are good. And these things are very hard to keep in your head and generally reason about.

2:07So the advice from functional programming is essentially to keep these things to the bare minimum and possibly to nothing if your function maps into these things. the other reason why functional programming is nice is that it's very directly linked to mathematics so in mathematics you have theories of let's say polynomials or strings or lists or things like that and in none of these theories you will find the concept of mutation it just doesn't exist so you can take a polynomial and you can transform it into a new polynomial but you can't change a coefficient at 0.3 at the third coefficient and pretend it's the same polynomial.

2:50It's not in mathematics, right? It's clearly something different. So functional programming, you could say, follows quite closely the way mathematics sees things.

2:58Martin Odersky:What would you say to someone that doesn't do functional programming because it's not convenient? I guess two things. One is it's a learning curve. so initially you your brain is wired to do imperative programming from when you were very young I imagine most people learned an imperative language first and then it's hard to see how you would express things differently but if you persist in that a little bit and it doesn't really take much then you will essentially reap the benefits very quickly that you say well actually my program got a lot clearer I can understand it better I don't really have to track some steps, go step by step through my program with a debugger or things like that to figure out what it does.

3:48Typically, I don't need a debugger when I write functional code. That's really not necessary. The other thing is to essentially know when to stop. So there is a strand of functional programming called pure functional programming, which tries to express as much as possible in pure functions and to sort of delay the side effects to wrap them up in monads or whatnot. And that can get very inconvenient very quickly. So my answer to that would be it really depends, and in most cases it's completely okay to have your side effects as long as these are well documented and you use them. So basically use these things in moderation.

4:35I would say functional programming is great for 95 % of your program, and if you need some side effect and some imperative feature for the last 5%, that's also okay.

4:44Martin Odersky:Is there any quantitative measure of the, I guess, the correctness benefits that functional programming gives you over imperative? I think there are some studies. It's not quite clear how significant they are. I think people criticize them a lot. The studies tend to say that a language like Scala would have fewer bugs than a language like C or C++. us. But I don't really want to sort of insist on that because these studies are very hard to do and the methodology is very hard to get right. I believe the effects become more important in large programs than in small ones. For small ones, you can do anything really.

5:31You can write a loop, you can write a recursive function, it doesn't really matter. And it's very much a matter of taste which one you prefer. But in a large system, I believe that, let's say, static types have certainly proven their worth. And even that, we don't really have a conclusive study that shows it. I mean, I can point you to a study, and if you're a dynamic typing enthusiast, then you will point to another that essentially claims the opposite. So it's very, very hard to do empirical software engineering on that scale. And so I'm afraid I can't really give a good answer. I just have the feeling that mostly functional statically typed languages is sort of a sweet spot for getting programs right.

6:18Maybe the other thing is when you really need to get them absolutely right, like with proofs and things like that. If you do a ROC or a LEAN or any of these things, these are all functional languages. So people wouldn't even attempt to do something like C, C++ here.

6:35Martin Odersky:When you think about Scala in the environment of all programming languages, what sets Scala apart? Or maybe put in another way, why should someone learn Scala in 2026? Well, Scala is the only functional language that is also a very capable object-oriented language. In fact, it was born by the idea that we can actually make a fusion of the two in a way which is not a side-by-side, but which really combines the features in a nice synthesis. So that was what Scala was about. That's what I wanted to show. And I think that's been largely successful. So you can write really beautiful programs in this combination.

7:19Object-oriented programming comes in when you talk about components and modules and essentially encapsulation, these sort of things, where functional programming typically doesn't really have a very strong story. I mean, there are languages like StandardML or OCaml that do have very capable module systems, but other functional languages don't. And people, when they think of functional programming, they don't really think much about components and interfaces and these sort of things, which are things that I believe also matter very much.

7:50Martin Odersky:Could you give an example, maybe like an object-oriented thing that you could do in Scala, but you couldn't do in Haskell, which is pure functional? It's sort of ingrained in the whole fabric of the things that everything is essentially objects, what you do. So one thing that you get is what I think Simon Brayton-Jones called the power of the dot, that you say it's super convenient. You have an object, and then you do dot, and then you have the environment that immediately tells you what are the methods and fields of that object that you can use them. So it focuses your mind, whereas in function programming it's typically you have a C of functions, that can be applied to arguments, and you have to figure out what they are.

8:34Martin Odersky:When you think about the systems programming languages, like Rust, Zig, Go, C, C++, in your opinion, which one would you say is kind of the best one, and then maybe we can compare it to Scala? In this day and age, a systems programming language needs to be memory safe, guaranteed memory safe. So that would already exclude quite a few of them, but it would leave Rust and Go, I think. and Rust and Go are at different levels. Go is really not a sort of a nuts and bolts systems programming language. It's a small language in which you would write, let's say, an application server or some middleware or some cloud infrastructure or things like that.

9:13It's not something you would use for embedded, say, which you would use Rust for. So I think in their domain, both of them are probably the ones that are the leading ones that I would take most seriously.

9:26Martin Odersky:And then when you compare Rust or Go with Scala, what are the pros and cons of the different language designs? What's something that Rust does better than Scala, something that Scala does better than Rust? So Rust is closer to the metal. You have better performance guarantees, I guess. The fact that Scala is a garbage-collected language means that you always have some pauses. I mean, garbage collectors have become quite capable. I mean, they're brilliant, and the pulses are really very, very small. But it's a fact that you do need a big chunk of memory to run fast, and I guess Rust could run in much, much smaller memory.

10:08So I believe that's better for embedded systems and things like that. I believe right now Rust is actually overused because a lot of people push Rust for things higher up in the stack where a garbage collector is fine, but essentially you still want to write code without. And that is, for me, a bit an exercise in, I don't know, just intellectual that I can do it. I don't really think there's a big sense in it that if you have the memory for a garbage collector, you should absolutely use one because it makes a lot of things simpler. So yes, of course, if given enough brains, I can write code around and I can do that.

10:54But why should you? I mean, it can be much simpler. So that was for us. Go is sort of a language bit that lags behind. I mean, it was intentionally designed to be very, very small and essentially to be the standards of languages in the 90s. So now they have gotten generics, which is a big step. So I believe that sort of is sort of a step forward for that. But it's still a fairly limited language what you can do, which has an advantage that essentially it forces a very uniform style because there's not much different things you can do. And that's probably a culture fostered to do things in a certain way, which makes it easier to essentially read one's other's programs and essentially jump in a new code base and things like that.

11:47So I think that would be my main advantage of Go that I see there.

11:51Martin Odersky:Is it possible to turn off the garbage collector in Scala? Not in production. So we have some research that would let you use essentially your own memory allocators and things like that, the way, let's say, Zig does it. The problem with that is always that you can leak references into memory that you reclaim, and then all help breaks you lose. Essentially, you point to memory that's undefined. But in Scala, we now have a very good way to actually track these references, so we can actually prevent that statically by the type system, that this will never happen, and you can still have your own allocator.

12:35That said, we haven't really shipped that in production yet. So right now I would say you use the garbage collector Scala, yeah.

12:42Martin Odersky:I see a lot on the internet people comparing Rust and Zig or kind of a fierce debate on which one is better. When you think about Rust versus Zig, what are the merits of the two comparing to each other? So what I can see is Zig has a really nifty compile time construct. essentially inlining, where the compiler does smart inlining. And that is quite clean and quite powerful. And Rust has macros, but I think they're more clunky than the Zik version. In Scala, we have something quite close to Zik. We also have essentially a thing that's based on inlining and optimizations by the compiler. but we have a restriction which I believe SIG doesn't have and that is that there cannot be additional type errors after inlining.

13:41So the thing is you inline and then the question is is the inline program guaranteed correct, so type correct or might you have type errors? The typical example where you might have type errors is C++ templates. In fact, that's quite scary in C++ that you can expand a template and then you get very, very complex type errors and very, very hard to debug things. So Zik, I believe, is much better because the inlining mechanism is much saner. When you say inlining, can you explain the concept? Inlining just means that in Scala, we can write inline in front of a function, and that means that the compiler will, before it starts code generating, so during the time when it looks at the type code, which are trees, it will take the function body.

14:32When it sees a function call to that function, it will take the call and replace it by the body. And then it will do some optimizations. It can say, okay, so here we have essentially an application to, let's say, a value which is a lambda, but I know where the lambda points to, so let me forward the call right to the function. And with that, you can already do quite a bit of essentially optimizations which are guaranteed because the inliner must inline. That's not a thing like an optimizer has essentially discretion whether they want to inline things or not, so you can never rely on that. But an inliner which is essentially a compile time based on the type must inline so you can rely on it.

15:21And constexpr by in Zik and C++ is essentially very similar.

15:25Martin Odersky:Okay, so it's a way to get rid of the function call or the overhead of a function call and tell the compiler you can do more because it's all, I guess, in line. Yeah. You reveal the implementation and that means you can, the compiler can do something with that. When you think about all the dynamically typed languages, which one stands out as one that you think is kind of the best among them? Python is ubiquitous, and it has a nice syntax. A lot of the Python programs look like they're very easy to read, so that's definitely an advantage. And the other one would probably be something like Scheme, which is sort of very grounded in computer science theory and lambda calculus and things like that.

16:17So both of them are sort of interesting in their own way, but of course Python is 100 times more popular.

16:23Martin Odersky:If you compare Scala to Python, for instance, I guess what are the trade-offs that the two languages took? I think the gap is closing because Python now actually has an optional type syntax and a number of type checkers that check that syntax. And Python is getting some of the features that Scala had since the beginning, like pattern matching is in one of the recent Pythons. So I think actually the gap is closing not just between Python and Scala, but between a lot of programming languages in general. They sort of all drift to a standard set of features which mostly come from functional programming, actually.

17:01Pattern matching, for instance, strong type systems, generics, polymorphism. All these things came from closures. All these things came from functional programming. And so the gap is closing in that sense. Python is I think the main advantage of Scala over Python is that it has a strong type system that is always on and that gives you essentially guarantees that essentially certain bad states can't happen. So I really can rely on it. Whereas I think I believe the Python type system, well it's just syntax, it has a number of type checkers, but But in general, you have fewer guarantees. And I believe it's also the ecosystem and culture that doesn't value types as much in Python.

17:52So I think that's probably the main difference. Contractically, the two languages I think with Scala 3 are actually also quite close. So Scala 3 looks a lot like Python. in that sense you could say I can see it as a language that has strong types and runs on

18:13Martin Odersky:different runtimes than Python. Or I should say the other thing with Python which is really great is that Python is a fantastic glue language because I can essentially have very, very efficient linkages to high performance C++ libraries Pandas or NumPy or things like that. You mentioned a lot of the programming languages, they're kind of drifting or kind of being inspired by the other ones and, you know, adopting new features. In the design of Scala, is there a programming language that you admire most and influences Scala the most? Historically, Scala was essentially, you could say it was a blend of Java, OCaml, and standard ML, which is an ML-like language, and Haskell.

19:01So I'm by trade an imperative programmer. My PhD is from Niklaus Wirth, so I know Pascal, Modula. That was sort of my first generation of languages, and I liked them a lot. And then I became sort of a converted functional programmer. So I looked very closely at ML, OCaml, Haskell, and these things. And then Scala came about, sort of, there was a predecessor language called PISA. And I was working on that with Phil Wadler, who's one of the Haskell original designers. And the idea was to have, essentially, an accessible functional language on a very widespread platform, which was the JLM at that point.

19:44and in order to prepare for that, I wrote a Java compiler. So that's how I learned a lot about Java and what Java was. And in the end, I had to say, well, it's actually quite useful. I was quite dismissive at first, but afterwards I found it actually quite useful. I mean, this was very early Java. This was Java even pre-1.0. So now Java is, of course, even more useful, but also a lot bigger than what it was at the time. So when we came up with Scala, which was sort of the second iteration after pizza, pizza was the language I did with Fruirwater,

20:25the ideas came mostly from Java, OCaml for the modules and the component model, and Haskell a lot for the standard libraries. So if you look at the function names in the Scala standard library, then there's sort of a mixture of OCaml and Haskell, you could say. But you recognize a lot of things coming from both of these languages.

20:48Martin Odersky:If I recall correctly, Java had some sort of licensing with it or was owned by a company. How were you able to build on top of Java? Did you have to pay for licenses or how did that ecosystem work? The language standard was open source. There was a lot of experimentation with Java at the time. I think the only thing that Sun was the company at the time, they're very particular about is that you absolutely, if you did something that was using Java and had Java in it, you had to call it Java, and you couldn't have a different name. So that's why initially, for instance, Microsoft clashed with them.

21:34and then Microsoft went away and designed C Sharp, which was sort of a Java on some steroids. They threw in a bit more than what Java had at the time. I think the nastiness came. Sun was actually quite an open company. So at the time, we were not worried about that. So that was in the timeframe from 1998 to 2004, 2005, something like that. and at the time there was no issue i think the issue came later when sun was acquired by oracle and google forked scala on android java on android and that's when the fight started but that was

22:14Martin Odersky:much later so when you say that scala was using the jvm or built on top of it like concretely in the the tech stack what does it mean that scala uses the jvm like how does java source code eventually execute on a machine? So the JVM is essentially defined by its bytecode. So the bytecode is essentially an intermediate format, which you can translate your program into. And then the bytecode is run first by an interpreter and then essentially by an optimized compiler, just-in-time compiler, JIT. So that's called JIT. They do that. and so if you know how to output bytecode and that's not very hard, then you can run on the JVM.

23:06So that's essentially the idea. The harder part then is interop, that you say, okay, I run on the JVM. I have to make sense of all these Java libraries out there, so I have to somehow map a Java concept into a Scala concept so that the compiler can understand what it is and I can document what it is for Scala programmers that maybe don't understand much Java. So that is sort of a work that sort of goes more into the details. That said, I mean, that's not the only Scala platform. So it was born on the JVM, but now it also exists on JavaScript and Node.js, on Wasm, and on Native. So it's really a multi-platform language.

Read the full transcript

23:50Martin Odersky:OpenAI, Anthropic, Cursor, and Vercel all use this product to make their lives better. And the problem it solves is when you're building SaaS or an AI product and you want to sell to other companies, there's all these requirements you need to meet. There's SSO, there's SCIM, there's RBAC, there's audit logs. These are all things that take time to integrate, but aren't the main focus of your app. WorkOS is an API layer that lets you meet all of these requirements in just a few lines of code. So let's say you have a new SaaS product and you want to sell to other companies, WorkOS will solve all of these critical feature gaps for you.

24:27Martin Odersky:You can check them out at workos.com to learn more and get started. And I appreciate them for supporting my work and sponsoring this podcast. Jira by Atlassian isn't just for tracking work anymore. Now you can pick your favorite AI agent to assign tasks to, and they'll get access to the rich context that's already in Jira. When the agent is done, it surfaces a pull request. That way you can get more done with your favorite agents all in one place. Learn more at jira.dev. That's J-I-R-A dot D-E-V. Appreciate them for sponsoring the podcast and back to the show. Let's say I write a Scala program.

25:05Martin Odersky:I have the source code. I have to compile it and then I have some Java byte code and then I call, I don't know, JVM and I pass in this bytecode and it just works. Yeah, yeah, exactly. What would the advantage be of compiling Scala to Java bytecode instead of doing something like C and C++ where you compile it all the way to machine code from source? We have that too. So the Scala native compiles directly using LLVM to native code. the advantages of compiling to bytecode is essentially again the interop can use all the Java libraries then the garbage collectors so the JVM has actually very good garbage collectors high performance ones and the runtime loading so what I can do on the JVM is I can compile let's say a one line thing into a little Java a bytecode and they can immediately load that bytecode and execute that.

26:12And that makes it very easy, for instance, to have a REPL because that's how a REPL would work, a redeveloped print loop. So I would just generate a snippet of Scala code to bytecode, load it into the running JVM process, and it gets executed. And that's much harder if you go to binaries, basically. Bineries don't really have a concept for that.

26:33Martin Odersky:You mentioned that you wrote a compiler for Java before Scala. and I've heard that compilers are notoriously hard to build. Can you explain the hard parts and why they're hard? Compilers are very intricate because I think there are a lot of requirements on a compiler. So you have languages which are already complex artifacts. Then you have a thing called type inference. So you have a type system, but essentially you demand the compiler to essentially infer a lot of types that make sense because you as a programmer think the compiler should know that, and it should. But actually for the compiler to do that is quite hard.

27:21And then, of course, you also demand that it would generate very efficient code for your program because, again, the compiler should know that, right? So there's a lot of demands on that, plus there's a demand that it should be very, very fast. And to square all these demands requires quite a bit of work, basically. There are also things that make it easier for compilers because they're fundamentally deterministic programs. So essentially you run a compiler on a source and you always get the same output. So it means they're easier to debug. You can just replay things and repeat things. Whereas if I would have some cloud service or distributed application, that has other nightmares, right, that every run is different and how do you even figure out what goes wrong.

28:07Martin Odersky:So when you wrote that compiler, I think Expresso for Java, how long did it take to write that by hand? At the time, it took me about three months, I think. Not full-time, maybe half-time, three months, half-time, something like that. But that was a very simple compiler. So that's the other thing with compilers. They typically start simple, and when you're at the 10-year mark or 20-year mark, then there's lots and lots of essentially other requirements to a compiler that make them more complex. Were there libraries that you could rely on to kind of piece together components of it, or did you have to write everything from scratch?

28:46I wrote, there was a library to generate bytecodes, I think. I think I used that in that version. Yeah, I did, yeah. So there was a library that, essentially a high-level library to just assemble bytecodes and put them into the right format and things like that. But that was essentially it. The rest I wrote by hand.

29:07Martin Odersky:That's crazy because, well, I mean, these days a lot of people, even more so now, are thinking less, using AI more to kind of, you know, write the code. So that's pretty impressive. I saw one of the big, I guess, moments for Scala was that Twitter adopted it, and I wanted to know the story behind that. How did they choose such an obscure language at that time? It was very obscure at the time. That's true. So I believe the story was Twitter originally was written in Ruby. And it wasn't very reliable because I believe it's, again, a problem with garbage collector and memory management and things like that.

29:47So the – and it was a small company at the time, so 25 people, including the ops people. and essentially the board and VC investors said you can't go on like this, being unreliable like that. You should do Java because Java was sort of the solid choice at the time. But some of the engineers at Twitter, they wanted essentially something more fancy as a programming language and there were some people who knew OCaml and liked OCaml but of course OCaml didn't run on the JVM. And then they found Scala and said, well, Scala is actually quite a lot like Okamo. And we can tell our investors that we do Java because that's not a lie.

30:31We do JVM, JVM bytecode. That's essentially what it comes down to. So that's why they picked it. And they were quite the first. But once they picked it, sort of the floodgates opened because at that time they were a very interesting company and a lot of people admired them. So a lot of people followed and did the same thing then. mostly they came from dynamic languages. So Twitter came from Ruby, others came from PHP or JavaScript, things like that.

31:00Martin Odersky:I mentioned a little bit that AI is kind of generating a lot of code. And I wanted to ask you what you thought maybe the future of programming languages might look like if you kind of speculated or drew out further into the future. If AI is generating more of the code, how do you think that might affect the programming language ecosystem? Yeah, I think right now we're sort of in an existential crisis, right? So we have AI generating the code, but humans being asked impossible tasks, like to review all these mountains of code and things like that, which will never work. and at the same time AI has also gotten extremely good at exploiting vulnerabilities in code like we all heard of Fable and things like that that you can't use it anymore because it's too dangerous it will exploit things so we are at a moment where it's essentially very dangerous that we lose control as humans of what actually happens here and that's a challenge that I think programming languages can help meet and probably definitely not only programming languages, that's not a silver bullet, but they definitely can help things.

32:18So I think one of the things is that the focus, if the code is AI generated, then the focus has to go elsewhere. And I think the focus will go to the interfaces and to the types. So I expect types will become a lot stronger and more precise than what we had because types is essentially the handle that we can make a contract between the human and the AI that the human can understand and that's concise enough to be reviewed and that essentially the AI can keep to. We have to level our game quite a lot because right now, let's face it, type systems are mostly recommendations. They're mostly things that mostly hold, but not always.

33:07There are no guarantees because you can always have a cast or use some dirty memory. I mean, there are a lot of techniques to sort of undermine the type systems. And we have to close all these holes from the beginning because once there is a hole, somebody can exploit it. So I think strong types, strong high-level types will help. and then I think the other part is generally the programmer has to think much more about what are the requirements and what are the essentially the high level specifications and be able to leave the code to be generated by somebody else in confidence and I think we're not quite there yet but we have some ideas how we could get there so one technique that I believe we can use and it has been around for a long time but maybe it's time has come now this capabilities capabilities essentially was used in operating systems to give very fine grained permissions to entities, users, programs and things like that and I believe that can be used also for agents and agentic AI to say, well, once we have agents, we have to give agents very precise and fine-grained capabilities what they can do, and that lets us essentially be confident about what they will not be able to do.

34:36Like, they will not be able to leak my API keys or my email or do other things, right? So I think that's an important part. And the existing languages are not there yet. I think Scala is halfway there, at least it's there in essentially stuff we're working on, which we have in the lab and we have released as an experimental feature. So I'm quite excited about that. The first thing that you have to do is definitely be memory safe. So a language that essentially is not safe in memory that lets you essentially access undefined memory is immediately out because you can't guarantee anything. So in that sense, it's good that there is a drive to use, let's say, Rust as a memory-safe language.

35:26That was even promoted by the American government, I believe. So that's definitely a very useful drive. But I think you need a lot more because you need much. Rust talks essentially mostly or only about memory. You need to talk about a lot more things than memory. You need about essentially read permissions, write permissions, access to secrets, It's all these things that go beyond that. And you could say, okay, Martin, you're totally unrealistic because all our software is written in C and C++, and we will not be able to rewrite that. But that, I believe, AIs can help there, right? So AIs are great in rewriting software.

36:12So if we know what to rewrite to, I think we might be able to get there.

36:17Martin Odersky:You mentioned some of those experimental features in Scala that might have some sort of safety guarantees or signal capabilities. Can you explain what that might look like or maybe give an example? A simple example would be, let's say somebody gives me a file and I have access to the file. Let's say a log file or something like that. I have access for a file for a limited time and then I need to close it. So typically I have an operation that essentially somebody passes a file to me, to an operation that my program provides, and the program does something with the file and then the environment will close it.

36:59But how do we make sure that I don't hold on to the file after I get it back to the environment or after I pretend that I'm finished with it? Because, hey, I have a file. I could have stored it in a variable. I could have stored it on the side. I could have gone back to it and done something with it. So capabilities help me prevent that because essentially I can say, okay, so this file is a capability, and then I can further say, well, this capability can be used only in a limited scope, and the type system will make sure that the capability doesn't escape. And the way we do that is that if a type refers to capabilities, So if I have a thing that I say, I give you back a lambda or a stream, and it holds on to the file.

37:45So the stream holds on to the file in secret. In our language, that won't be a secret anymore because the type has to declare that the thing I return does hold on to the file. The file is a capability, and I can't essentially hide capabilities I have access to in my type. I have to declare them. And that gives me essentially this control that then I can also enforce to say, well, at this point, you're not allowed to have any capability because the type that I enforce you to have is a type that doesn't hold capabilities. And that way I enforce with the type system something which previously hasn't really been enforceable.

38:25For memory safety, it's essentially the same thing with arenas that I have an area where I allocate memory and then I want to get rid of it, I have to make sure I don't have pointers pointing into it. And that's exactly the same situation. And let's say for accessing secrets again. So it's a very common pattern that I say, in certain situations, I want to make sure that you don't have, or that you only have a set of defined capabilities that I give you and nothing else.

38:56Martin Odersky:You mentioned memory safety is an absolute table stakes. What are the programming languages that you think of that are not memory safe? I know there's C, but what are the other ones? The big ones is C, C++. I don't know about, I think ZIC or NIM or other low-level systems languages are not memory safe. So that was sort of in Rust a big achievement that you say you can be a low-level systems languages and be memory safe. Nobody sort of thought that it was possible before Rust came. So that's why I would think, I don't want to say anything wrong, but I would think that essentially most other low-level systems languages would not be memory safe.

39:40But you really need more than memory safe. You really need capability saves that you say when I essentially hang on, tell you I can't sort of forget capabilities to say I hang on to something and I just conveniently forget that I have access to that. And I can't forge capabilities to say, well, if I need a capability, I just make one up. So these two things need to be prevented. And that goes beyond memory safety. But without memory safety, essentially you have nothing because you can fake everything.

40:12Martin Odersky:A lot of programming language design and how we write code in the past is writing the source code so that it's nice for humans to read. But if humans are no longer interacting with the code, what kind of things come to mind that we might not care as much about but are good for machines to read, for instance? The first thing is maybe sometimes you want to read it, but you probably wouldn't have written it. So easy to write is definitely not a big criterion anymore. Easy to read to some degree, yes, but that means you don't need any sort of syntactic hacks like to write plus plus in C or things like that.

40:55That's easy to write, right? But I don't, I mean, I'm sure we will still have that, but it doesn't really matter anymore. I mean, whether I write an assignment in long form or with X plus plus, whatever. So I think these things won't matter much less. The things that matter much more are, that continue to matter, and are essentially high-level ways to constrain and specify what my program should do. So constrain what it should not do, that's one of the things, and also specify what it should do. And, I mean, some people say it's a golden age for formal verification because we can be very precise in our specifications and our AI can actually not just furnish the program but also the proof that the program actually meets the specification.

41:48And I think that's true. That's really very exciting in a lot of areas. But in the large, the problem is you often don't really have the formal specification or it's just as hard to write a formal specification than to write a program or sometimes even harder. So that means that we will still live in a world where we specify things by natural languages, by prompt to the agent, and the agent then will do the code. But I imagine that also that will be a lot more formal in a way. So in a sense, right now the prompts, I mean, it's fantastic what they can do with the prompts, but then we throw away the prompt or it's hidden in the chat history with the agent.

42:33So that's really a shame. So I really should have the prompts as first-class values in my program that I can say, well, essentially that's what the program is about. And if I change the prompt, then the AI will know essentially what the incremental change was and change the program incrementally, these sort of things. That's another thing that I think we'll see in future programming languages for agentic programming.

42:57Martin Odersky:Maybe like some kind of meta information about the program, almost like a get blame, but like a prompt, I guess, blame of what generated that part of the code. You should be able to keep that around and come back to it. Also because you might want to change, right? You might want to say, well, now it's exactly the same, but I want to change this little detail, But I don't want the LLM non-deterministically to generate a new program because that way it might get a lot of other things wrong that I reviewed already. So there really should then be an incremental small change to the code. And that means I need to keep the prompt as a part of my program.

43:40Martin Odersky:Ten years from now, do you think there will be more software engineers than today or less? I think there will be less. and it will be a higher profession that essentially has higher standards, so it will be harder to become one. You will be able to know quite a lot of logics and maths to be competent at essentially keeping AI on the good track and things like that. It's sort of like a control engineer for a factory where you don't understand many things initially. It means that you must be higher skilled than a factory worker of 50 years ago or something like that. And I think the same will happen for software, where you will need fewer but more qualified people.

44:34Martin Odersky:One thing that a lot of people recommend is to become better at programming, you should learn multiple languages. and I wanted to know, aside from Scala, what are the top programming languages you would recommend people learn to expand their mind? So definitely a systems language. I think to know how hardware works and how software links with hardware, I would learn a systems language. And I'm sort of torn between C and Rust there because C has going for it that it's very simple and very close to the thing. In Rust, you have to learn a lot of abstractions, but on the other hand, it is memory safe.

45:13So I would say probably initially C to figure out what these things are, and then if you decide to become a systems programmer as a career, then you should switch to Rust, I guess. So that would be one thing. The other thing would be something more with a verification-improving background because that will become a lot more important. so I would actually do a course in Lean or Rock, one of these languages to say we should be able to use AI to develop first an intuition what it means for a program to be correct because I guess most people have only a very very fuzzy intuition for these things and learning one of these languages would sharpen the mind And then, of course, Scala, too, is a language that essentially sits right in the middle where fairly provable, strong types, high expressivity, these sort of things.

46:18Martin Odersky:When you think of a top technical book that you might recommend to people, does anything come to mind? I got a lot out of structure and interpretation of computer programs. That was a book from the 90s. It was the intro text at MIT at the time. or 80s even, I think. And in fact, the courses I taught on Coursera and DPFL are based quite a lot. To some degree, they're based on that material. So, of course, not the same language and strong types instead of dynamically type but still. When you look back on your career, why did you choose to work in academia instead of industry? When I came to the end of my studies, I was asked to do a research project.

47:01and the project I picked or the prof then asked for me to modulate that a little bit. In the end, I found it super interesting to say I work on something that I don't know whether it has a solution or not. So it might be that the question is yes, it might be the question is no, we have to do research. And that's sort of how it started. And then I believe the main advantage of being in academia is really the long term and being independent. So in the long term, I mean in industry, I'm sure there are many periods, including now, where I could be paid 10 times what I'm being paid at university. If I joined Google or any of the other companies in Silicon Valley.

47:49But then times also change, and sometimes essentially what you do is not only relevant, and then it's very easy to get fired, and then you say, no big deal, I can do something else. But at a university, you have essentially long-term tenure to do exactly what you want. So no manager, you can define your own research agenda. Of course, you have to get some money. That is hard. You have to get grants and things like that. You have to convince students that what you do is the right thing, but that's also very rewarding, working with students. So I think in the end, I'm very happy that I took the career I took.

48:28Martin Odersky:What about looking back on Scala? You have so much experience there. What are some things that went well or things that didn't go well and maybe some learnings you could share? Scala was initially this experiment that we could combine object-oriented and functional programming. And technically, that experiment was a big success. In terms of the ecosystem, it had a lot of challenges. I don't know whether you know there was a short, incomplete history of programming languages by James Irie, which is quite hilarious. And there's a scholar entry there that says I discovered Reeves butter sandwiches and I had an idea to essentially have a language where you put in both object and functional.

49:12and then it ends with dismisses of both communities and they promptly declare jihad. And that's, at the beginning it was very funny, but in retrospect that's to a large degree what happened. I mean, there were a lot of fights and cultural fights and things like that. So, and we might have, it was a challenge and I don't know, in retrospect, I think it might have been more prudent to be more careful introducing functional features because that sort of was, we went in essentially quite complete. So essentially you can port most Haskell programs to Scala maybe. You find them a bit less attractive looking, but you can do it.

50:04and that brought in essentially different cultures and it caused a big clash of cultures. For instance, Go was a lot maligned because they didn't even have generics, right? And it's true, it was a ridiculous language. But by not having it initially, you sort of form a culture that when you add it, nothing much will go wrong and people won't over-abstract or things like that. And by essentially going full hog into it with Scala from the start, we were not protected against that. And people did reach abstraction peaks and over-abstracted and things like that. And they still do it to this very day.

50:48So essentially having fancy abstractions is great, but you have to use them responsibly. and then it sort of clashes with the natural urge to just try out all these fancy things and do something that in the end maybe neither you nor nobody else understands very well. And it could have just been a simple map or things like that. But yeah, why do I use that when it can be complicated?

51:13Martin Odersky:Why would that upset someone? Because of the library ecosystem, I think.

51:22So the libraries are important because they sort of set the agenda how you express your programs. In particular, the libraries that come from the Haskell side, they are essentially monadic frameworks and they require you to express your whole program as a monad, which is a concept that works well in functional programming. I have my reservations. I wouldn't actually do that in my Scala programs. But by having prominent libraries out there, it's quite normative that people feel like they're being a Scala programmer. They're required to program this way. And then, of course, there are opinion leaders and conferences and all these things that tell you how you should be writing your programs.

52:08where I would say I think the most of the Scala community is actually very, very level-headed, and I think most of the advice is great. But then, yeah, it's still a challenge because it's just too easy to... Mostly it's not really the opinion leaders in the community, but let's say it's your boss. You have a small team in a company. Your boss came from Haskell and says, hey, this is great, we do exactly like Haskell, the whole thing. And then two years later, the boss's boss says, no, nobody can understand this code and the project is canceled. So these things happened in the industry. I'm not saying that all projects are like that, not at all.

52:54I mean, there are lots of really great success stories of Scala, but that's essentially a challenge. in terms of techniques I think in the end I wish we had been a bit less dependent on the JVM in the sense that we took a lot from Java that intuitively makes sense but in the end and was very important for Interop but in the end could have been done better so for instance in Java being an object-oriented language, you have universal methods like two-string and equals and hash code, and they're defined for everything. And languages like Rust or Haskell, they're more discriminating. They have a thing called type classes where essentially at compile time you tell exactly where you have equality and hash code and these things.

53:49And it's a bit more tedious to set these things up, but in the end, it's also safer. So I wish we had that. And we couldn't because we sort of adapted Java's notion of what an object is. And it already came with all these things, which is sort of very convenient, but in the end caused friction.

54:10Martin Odersky:If I went back to you at that time when you were starting it, I said, what do you think is going to happen 20 years from now? What would you have said? I would probably have said that, well, it was a footnote in memory. because, I mean, let's face it, you do a thing and initially we had maybe five users or something like that outside our group, something like that, right? And you don't really expect that it would change a lot. And so, no, I think it was quite by surprise that this actually happened. And I think the reason why it happened was that at the time, Scala was a good bridge between dynamic languages that are slow and sometimes they crash, and solid languages, statically typed languages like Java, which were at the time quite cumbersome to write code.

55:10And there was a lot of ceremony and things like that. and Scala had inferred types so you had types but you didn't see them much so it felt like a dynamic language but it had also the solidity of essentially a good platform and I think that's what made it and we've been copied a lot by a lot of other languages that put in these features then 5 or 10 years later or things like that but at the time it was sort of Scala that was the first one that had it and that's sort of why it happened but I wouldn't have foreseen that

55:42Martin Odersky:by no means. Looking back on your career, when you just graduated college and kind of started your career, knowing what you know today, what advice would you give your younger self? I think to take risks, be adventurous, pay it out. So essentially don't follow the mainstream. If you take a fancy to do something wild and crazy, technically take the time to do it and do it. But I mean, yeah, so that's what I would, of course, I mean, you still need to sort of stay on track somewhat, but I don't want you to exaggerate that either. But yeah, so basically be a bit non-confirmist. Awesome. Well, thank you so much for your time, Professor.

56:31Martin Odersky:I really appreciate it. Thank you, Ryan.

56:42Martin Odersky:for people you want me to bring on. Please drop a comment. Guests like Barbara Liskov, Mike Stonebreaker, Mark Brooker, these were all people that I brought on because someone left a comment. On another note, aside from the podcast, I'm working on building the ergonomic keyboard that I wish existed. Here's a glance at the prototype. It's a split keyboard. So there's two sides. This is in the case. But yeah, we launched on Kickstarter and we hit our goal within eight hours of launching. I really appreciate it if you were one of the people who grabbed one of the early units. We're now working on the long journey of building the tooling now.

57:17Martin Odersky:And so if you still want to pick one up, I've left the late pledges open on Kickstarter. So you can grab one there. I'll put a link in the description. Thank you again for watching the podcast and I'll see you in the next episode.

From the publisher

Martin Odersky is the creator of Scala and I interviewed him to compare different languages designs (Rust vs Zig vs Python vs Scala) and how AI will impact programming languages.


• My ergonomic keyboard project I mentioned, you can follow along here: https://read.compose.llc/

• The Kickstarter page for it: https://www.kickstarter.com/projects/ryanlpeterman/compose-simple-ergonomics-beautifully-done


Podcast links:


• YouTube: https://youtu.be/LdN4sPWM-WY

• Apple: https://podcasts.apple.com/us/podcast/the-peterman-pod/id1777363835

• Transcript: https://www.developing.dev/p/creator-of-scala-comparing-languages?r=n49ky


Thank you to this episode's sponsors for supporting my work:


• WorkOS: makes your app Enterprise Ready with easy to use APIs to add SSO, SCIM, RBAC, and more in just a few lines of code, check them out at https://workos.com/

• Jira by Atlassian: Get more work done with your favorite agents and models all in one place, check them out at https://jira.dev/


Timestamps:


(00:00) Intro

(00:44) Why care about functional programming

(06:35) Why should people learn Scala

(09:26) Rust vs Scala

(12:42) Rust vs Zig

(15:45) Scala vs Python

(18:31) The programming languages that influenced him

(22:16) How running on the JVM works

(26:33) Why writing a compiler is hard

(29:19) Why Twitter adopted Scala early on

(31:00) How he believes AI will impact programming languages

(43:40) Will there be less engineers in ten years

(44:34) Top programming languages to learn to grow

(46:18) Top technical book recommendation

(46:51) Why he chose academia instead of industry

(48:28) Reflecting on Scala

(55:42) Advice for his younger self

(56:33) Outro


Where to find Martin:


• Wikipedia: https://en.wikipedia.org/wiki/Martin_Odersky

• Website: https://people.epfl.ch/martin.odersky

• X/Twitter: https://x.com/odersky

• GitHub: https://github.com/odersky


Where to find Ryan:


• Newsletter: https://www.developing.dev/

• X/Twitter: https://x.com/ryanlpeterman

• LinkedIn: https://www.linkedin.com/in/ryanlpeterman/

• Threads: https://www.threads.com/@ryanlpeterman

• Instagram: https://www.instagram.com/ryanlpeterman

• TikTok: https://www.tiktok.com/@ryanlpeterman


Referenced in this episode:


• Structure and Interpretation of Computer Programs: https://web.mit.edu/6.001/6.037/sicp.pdf

• A Brief, Incomplete, and Mostly Wrong History of Programming Languages (book): http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html

More from The Peterman Pod

All 60 episodes
Creator of Scala: Comparing Languages And How AI Will Impact ThemThe Peterman Pod · 58 min
Listen in VO