Erik Engheim
Jul 25, 2021

--

Good point, I should have discussed this solution as well. Allthough I don't actually know this from Smalltalk but from Objective-C and Swift.

Of course both languages derive from the Smalltalk OOP tradition rather than the bastardized Java/C++ style OOP.

I actually have an old article discussing this by showing how you can avoid the complexities of the visitor pattern by using class extensions: https://erik-engheim.medium.com/making-visitor-pattern-obsolete-using-swift-c16e49a2e52f

Interesting that you brought this up though, as I didn't know class extensions was a thing in Smalltalk. I had always thought that it was a natural part of Objective-C, since it was compiled. Assuming that in regular Smalltalk there would be less of a need as you could just go and modify any class you like.

--

--

Erik Engheim
Erik Engheim

Written by Erik Engheim

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

Responses (1)