[Pharo-dev] Phexample: API Change Proposal (was Phexample: Image Destroying Bug)
Sean P. DeNigris
sean at clipperadams.com
Tue Apr 22 10:40:59 EDT 2014
Reverting EyeInspector>>#updateList revealed the error when Phexample is used
in latest Pharo 3.0...
PhexMatcher uses #= as part of it's DSL e.g. "1 should = 1". Because it
doesn't respond normally to #=, #hash is implemented to signal an error
(self error: 'Don''t put a matcher into a dictionary. It does not behave
ordinarily on ='). I guess the receiver inspector on the bottom left of the
debugger keeps the items in a dictionary, so #hash gets called and
everything blows up.
The first thought that comes to my mind is that #= is "too cute" as a DSL.
#= is too deep of a smalltalk concept to justify hijacking, AFAICT to avoid
I removed #= and #hash from PhexMatcher, adding an #equals: with the former
#= implementation, and everything seems to work.
I don't have write access to
http://smalltalkhub.com/mc/Phexample/Phexample/main/ and realize it's a big
API change, so I committed the fix to
MAJOR API CHANGE:
- change matcher #= to #equal: e.g. "1 should = 1" would now be written "1
should equal: 1"
- update all code to use new API
Motivation: the #= magic made it impossible to store matchers in
dictionaries, and #hash was implemented to signal an error explaining as
much. Unfortunately, #= and #hash are deeply ingrained Smalltalk concepts,
and are assumed to work as expected. In Pharo 3.0, the debugger tried to put
matchers in a dictionary, causing an infinite error loop whenever a matcher
View this message in context: http://forum.world.st/Phexample-API-Change-Proposal-was-Phexample-Image-Destroying-Bug-tp4755787.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
More information about the Pharo-dev