<">
I mean, typecase using type specifiers makes sense, it’s a type-based operation after all. But handler-bind feels like a class- (or whatever the hierarchy of conditions are, they are not standard-objects iirc) based operation. Yet it uses type specifiers, and that’s a fun turn of events.
</">
My intuition is different.
I see this part of what `handler-bind' does merely (or at least essentially) as a kind of type dispatch (except that the primitive types are only condition types).
(Whether condition types are standard-classes is implementation-dependent, so they may or may not be such.
What is important is that the hierarchy of the kinds of conditions is integrated with the hierarchy of classes (and types).)
<">
I wish generics also allowed type specifiers. Imagine the world we’d be living in…
</">
To some degree I think we already do.
I haven't done this, so off the top of my head, I think it's possible to base method dispatch on (much of) what compound type specifiers allow by sufficiently heavy use of the Meta-Object Protocol and suitable metaclasses.
It would likely be also necessary to wrap `defmethod' in macro calls, but that is par for the course.
Whether that would be a good idea is another matter.
The complexity of the implementation would have to be justified.
Then this might reduce the efficiency of method dispatch.
(We usually don't mind when the efficiency of handling exceptional situations is less than the efficiency of "regular" execution.)
#CLOS
#CommonLisp
#CommonLispObjectSystem
#GenericDispatch
#MetaObjectProtocol
#MOP


