[squeak-dev] Smalltalk and functional programming

Colin Putney cputney at wiresong.ca
Tue Aug 24 17:43:36 UTC 2010


On 2010-08-24, at 9:35 AM, Frank Shearar wrote:

> Saying that Smalltalk isn't an FPL because its functions all happen to be associated with a class just seems foolish to me.


It is true that Smalltalk has a kind of "functional OO" flavour that is notably different from the "procedural OO" flavour that, say, C++ has. 

But I think you'd be doing a disservice to your audience if you call Smalltalk a functional language. The Big Idea behind Smalltalk was to limit mutability to the local object, and do everything with messages. The Big Idea in functional languages is to limit mutability to the stack and do everything with function application. Neither approach can be completely pure, so of course you can make functions out of objects and objects out of functions. Since it all boils down to machine code at the bottom, I think the utility of OO and FP really come from the way they help us think about programming. They're defined more by style than by crisp sets of tick boxes. 

Smalltalk and it's libraries are designed to be used in an OO style, and it doesn't make a lot of sense to write Smalltalk code in a functional style, even though it's possible. This is actually the reason I dislike CLOS: it's certainly possible to write Lisp in an OO style, but if you really want objects, you shouldn't be using Lisp. Similarly, if you want functions, you shouldn't write them in Smalltalk.

Colin


More information about the Squeak-dev mailing list