Is Smalltalk a Functional language? Is Lisp Object-Oriented?

This is an episode of Thoughts on Functional Programming, a podcast by Eric Normand.

Subscribe: RSSApple PodcastsGoogle PlayOvercast

Alan Kay says there are only 2 Object Oriented languages that he knows of: Smalltalk and Lisp. The deeper I go into the history of Smalltalk, the more functional Smalltalk looks.

Transcript

Eric Normand: Hi. My name is Eric Normand. These are my thoughts on functional programming. I have kind of a weird topic I want to talk about today. Has to do with Smalltalk and functional programming. The more I read about Smalltalk and its history, what early programs in Smalltalk looked like, the more it strikes me as a very functional language.

The abstractions, the little data structures that people created are defined in a very recursive way. I think the paper...the early history in Smalltalk, there is a linked list that's created that has a little object that has value and then a pointer to the rest of the list.

The method link is defined by adding one to the link of the next, the rest of the list. All the methods are short like that. It's just some very simple, concise, code that defines this whole linked list. The whole interface of the linked list including the implementation is a note card with the code.

A number of other things where Alan Kay has said...There is a number of other things that has made me think that when we talk about object-oriented programming, what we now call object-oriented programming has missed the point.

That what Alan Kay tries to emphasize is the stuff that is much more like what I'm calling functional programming. Which is kind of ironic. Alan Kay has said that there are only two object-oriented languages in the world — Smalltalk and Lisp.

https://twitter.com/ericnormand/status/1084118671881060354

Lisp is not traditionally thought of as an object-oriented programming language. Does that mean that our definition of object-oriented programming is just different from his and he is the creator?

Obviously, it is different, but is it that different that he would classify Lisp as object-oriented and almost no one else would? The fact that he has a lot of respect for Lisp as an idea...that he was inspired by Lisp to create Smalltalk.

I think that object-oriented programming and functional programming have a lot more in common than we like to think about. The modern practices of organizing these big classes with lots of immutable state and all that stuff that you would in a job of program.

I think that that is not really what, I'm going to call it true object-oriented programming, is all about. Creating these little abstractions that have little interfaces with nice recursive definitions — which is much more like functional programming — that is what the original definition of object-oriented programming was supposed to be.

I'm going to go and say it, I'm going to say it, Smalltalk is a functional language. If Lisp can be object-oriented then Smalltalk can be functional. That's my short idea of the moment. I do think that the good practices in both of them converge.

That you should be thinking about making your...like in functional programming we think, you need to have short functions in object-oriented programming. You need to have small objects with short methods.

They all kind of converge onto the same principles. There is just good programming at the end of the day. Now, what's different is the terminology, the ideas, the practices, the approaches to problem solving. But at the end of the day, good code is good code.

https://twitter.com/ericnormand/status/1014162070995132416?ref_src=twsrc%5Etfw

If you're going to make a small or recursive definition of something that should work in both paradigms.

All right. My name is Eric Normand. This has been a thought on functional programming. A weird one about Smalltalk, functional programming and object-oriented programming. Thank you very much.

I'd love to hear your thoughts on this. If you go to Twitter, I'm @ericnormand. You can also email me, eric@lispcast.com. That's my email address. Love to hear from my listeners. Please let me know, if you disagree, if you agree, anything.

If you like it, if you don't like it, let me know. All right. See you then. Bye.