[squeak-dev] Smalltalk and functional programming

Michael Haupt mhaupt at gmail.com
Tue Aug 24 19:23:00 UTC 2010


Hi Frank,

On Tue, Aug 24, 2010 at 6:35 PM, Frank Shearar
<frank.shearar at angband.za.org> wrote:
> Well, that's the thing. If you tried to write OO in Haskell, you'd fight the
> language, right? It's not natural to use Haskell to write OO. Similarly, you
> don't write OO in C because it _hurts_.

been there. Once you get the macros right, the pain fades away and
becomes a slightly annoying throb. ;-) Which is to say it was not that
bad after all.

About Haskell: I'm not (yet) familiar with monads and state in Haskell
(getting there, slowly), but I have the strong impression that writing
monadic code is about as elegant as most other things in Haskell. I
would not say it's particularly hard to "do" OO in Haskell. It's not
the primary abstraction, but a sufficiently capable Haskell programmer
would perhaps not feel bad about it. Just as a sufficiently capable
Smalltalker would not feel bad about "doing" things in functional
style here and there in Smalltalk.

> On the other hand, while clearly not a pure functional language like
> Haskell, it's not hard - it's _easy_ - to write in a functional manner.

That's what I meant above.

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

But that is not the case, right? How about blocks as closures?

Best,

Michael



More information about the Squeak-dev mailing list