15

One of the things I was most impressed with when digging into Pharo was that the Finder could do find-by-example. I'd previously only seen this in languages like Haskell, where it's possible to know for certain that a function has no side effects. How does Pharo manage to implement this in a way that is safe, performant, and side-effect free?

Avdi
  • 18,340
  • 6
  • 53
  • 62

1 Answers1

17

Magic :)

Actually... although I've been dreaming about creating the list from the tests automatically, the reality is that we manually maintain a list of safe messages (obviously error-prone; I seriously doubt it's 100% accurate). See MethodFinder>>#initialize.

So a trick, but not exactly magic ;)

Sean DeNigris
  • 6,306
  • 1
  • 31
  • 37
  • 6
    Thanks! BTW, I'm using this capability to melt faces over here:http://devblog.avdi.org/2015/05/11/in-which-i-make-you-hate-ruby-in-7-minutes/ – Avdi May 11 '15 at 21:46
  • 10
    It's worth noting that Pharo inherited this capability from Squeak Smalltalk. The Method Finder (by Ted Kaehler) is more than 15 years old now). – codefrau May 12 '15 at 08:03
  • 4
    Squeak was is and will be awesome, Pharo is based on it and owes so much to the hard work of people that made Squeak possible. Thanks guys. – Kilon May 12 '15 at 10:44
  • 5
    @BertFreudenberg let's also add that Kaehler's goal was to provide "programming by example" capabilities. The finder was a very nice step in that direction. The finder could also be related to implementing transactions (as GemStone does) or, more ambitiously, undo. – Leandro Caniglia May 12 '15 at 15:01