While developing Magritte, I have a problem because blocks that are
read/written to/from strings (e.g. via Magritte forms) have a different
outerContext before and after and thus I don't know how (without an ugly
hack) to determine whether they were changed by the user.
Question: Is there a smarter way to do block equality?
Currently in Pharo block comparison is via #==. In Squeak, there is:
BlockClosure >> #= aClosure
self == aClosure ifTrue: [^true].
aClosure class = self class ifFalse: [^false].
(self method == aClosure method and: [startpc = aClosure startpc
and: [self
isClean]]) "<--- this line"
ifTrue: [^true].
^outerContext = aClosure outerContext and: [startpc = aClosure
startpc]
I'm not totally sold on the implementation due to the `startpc = aClosure
startpc` the first time it appears (in the comment-marked line). With it, in
a workspace, the following is false: `[1] = [1]`, but removing that test
makes it true. I'd like something that returns true if both blocks are clean
and they "do the same thing". But I like the track it's on...
-----
Cheers,
Sean
--
Sent from:
http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
Cheers,
Sean