- Write a rough skeleton that calls "self fail" at some point.
- Write a unit test that calls the skeleton with real data.
- Finish the skeleton in the debugger, where I have test data right at hand to see if things work as intended.
Well, that's alright as far as it goes, but you can't work like that with
doesNotUnderstand:
methods.doesNotUnderstand: aMessage
self fail.
If you now call a non-existing method on an object of a thus modified class, you've built an endless recursion that is so close to the VM that you can't get into a debugger anymore.
Smalltalk's
doesNotUnderstand:
method is a dangerous superpower. And perhaps that's why just about nobody overwrites it in a standard Pharo image. Open problems
Do you know a more robust implementation?
- Non-existing calls inside the handler for such should be caught, I think.
- It should work nicely with code completion. (Code completion seems to be an integral part of just about every current approach to help programmer's productivity, so it better work nice.)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.