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

preview_player
Показать описание


#AlanKay 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

Hi. My name is Eric Normand. These are my thoughts on #functionalprogramming. 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 #datastructures 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.

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.

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.

If you like it, if you don't like it, let me know. All right. See you then. Bye. #Clojure
Рекомендации по теме
Комментарии
Автор

smalltalk is super interesting. receivers and messages.... sick way to learn programming, make so much sense... syntax is secondary, the idea of receivers(objects) and messages makes so much sense, compared to how they teach OOP today, very weird we got away from THAT paradigm... glad to see a young person talk about this!

JR-lybx
Автор

There is a language called skill that is a lisp but with structs and some c constructs for math. It is used to develop software that's been designing chips for 95% of the market for the past 30 years. Yet nobody talks about that. Shows how relevant what programmers think it's popular is

Kenbomp
Автор

I think the waters are muddied by "purely" <paradigm> languages - they've created artificial barriers. In Smalltalk functions (blocks) are objects. In Emacs Lisp, OClosures are also both function and object. C++ and it's ilk has become the poster child for OOP when really it's an embarrassment to both Smalltalk's OOP and the more powerful Common Lisp Object System or "CLOS". You can even make closures act like objects in Scheme by closing over variables and taking a message to act upon them or even return an internal function within that closure which acts on member variables. If anything though Lisp has started more as an imperative language when you look at things like PROG appearing since LISP 1.5 and carrying onward. Multi paradigm is preferable in Lisp because it lets us implement new paradigms (things like Prolog style Horn clauses) without too much resistance.

PixelOutlaw
Автор

Commented the same thing on your other great video ("early history of smalltalk"). This is a tremendously fruitful common ground between the 2 paradigms. You're onto it precisely. The level to which PARC people understood and appreciated FP is undeniable. They get it, the probably expressed themselves well in LISP and Smalltalk.
As for the rest of us and the industry, well, the saying is: "You can write COBOL in any language".

ytflix
Автор

You said something like "lisp isn't traditionally thought of as object oriented", but that is not necessarily true. There was a whole era of OOP style lisp through things like CLOS (Common Lisp Object System), and you see people harken back to that all the time on Hacker News whenever people talk about lisp. "Art of the Meta-object Protocol" is a classic OOP text which uses lisp as its language. Honestly this idea that lisp is a functional programming language is a modern idea. If we go back even further before OOP, lisp was extremely imperative and procedural. What made it unique was the "code as data" thing. But it was never really a functional language the way ML, Haskell, etc. were. The exception to that would be certain dialects of lisp that promoted "functional programming". Obviously Clojure comes to mind (using immutable data structures as the default, etc.). But to say "lisp was traditionally thought of as a functional programming language" is not really true in my opinion. If you asked an old timer from the 60s, 70s, etc. I think they would agree with me.

I appreciate your thoughts on this subject, just wanted to nitpick a little :)

aerialdude
join shbcf.ru