CC: | natg [...] shore.net |
Subject: | Toaster should not be 'called' if object can't do it |
When Toaster is defined, Dump applies it to every frozen object. This
makes the feature hard to use in cases where some classes have toaster
methods and others don't. This is a common case, because it arises
whenever you Dump a structure that contains objects produced by a module
developed by someone else.
The only workaround I know of is to add the toaster method to UNIVERSAL.
This grates a little on the soul but works. If this is the way you
want people to use toasters, I suggest adding a remark to the
documentation, since it is a bit subtle. Otherwise, perhaps you could
make the small change to the code needed to catch this case.
I realize there is some subtlety in specifying the correct behavior in
cases where the class also has a Freezer method. If the freezer changes
the object's class, the 'right' thing to do is make sure the new class
has the toaster. But there's no guarantee that the new class is even
loaded at Dump-time. A reasonable compromise, I think, is to assume
that if the class has a freezer, the programmer knows what s/he's doing
and will ensure that the new class can do the toaster.
Many thanks,
Nat Goodman