[Cuis-dev] overriding doesNotUnderstand
ken.dickey at whidbey.com
ken.dickey at whidbey.com
Mon Jun 10 09:01:37 PDT 2024
On 2024-06-10 07:42, Mark Volkmann via Cuis-dev wrote:
> I'm learning about overriding the `doesNotUnderstand` method in a class
> to support processing somewhat arbitrary messages. But the Smalltalk
> editor is perhaps being too helpful. It doesn't want to let me send an
> "unknown selector". So it's not clear to me how I can send a message
> that will trigger my implementation of the `doesNotUnderstand` method.
> Is there a way I can do this?
When you save the method, you can just `confirm` this selector is what
you want.
It is useful to have unknown selectors, BTW to "debug code into
existence". Just keep running the code and write code for the selectors
as they come up as missing into the debugger.
Use of #doesNotUnderstand is frequently the wrong thing to do.
An interesting useful case in the the #'Color-Extras' package:
Cuis-Smalltalk-Dev/Packages/Features/Color-Extras.pck.st
This is used with the ability to switch color dictionaries.
Note various dictionaries in
Cuis-Smalltalk-Dev/Packages/Features/NamedColors/
Another interesting bit of usefulness in Color-Extras.pck.st is the use
of
#prePackageInstall and #postPackageInstall
to satisfy pre- and post-conditions.
HTH,
-KenD
More information about the Cuis-dev
mailing list