How does find-by-example work in the Pharo Finder?
Asked Answered
B

1

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?

Beeck answered 11/5, 2015 at 20:59 Comment(0)
W
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 ;)

Woe answered 11/5, 2015 at 21:36 Comment(4)
Thanks! BTW, I'm using this capability to melt faces over here:devblog.avdi.org/2015/05/11/…Beeck
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).Lucas
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.Klos
@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.Goodall

© 2022 - 2024 — McMap. All rights reserved.