[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OBJECT-ORIENTED CLX
Date: Tue, 01 Nov 88 12:17:31 -0600
From: "David C. Martin" <dcmartin@cs.wisc.edu>
Lastly, I didn't quite understand the following:
----- from Kerry Kimbrough (10/31/88)
This alternative would be much improved if there actually was a way for CLX to
dispatch on programmer-defined subclasses *inside* process-event. It's not
clear how to implement this. Another thing is that I've noticed it's
frequently useful to define a new event subclass procedurally, either via a
relation predicate over its slots (e.g. :button-1-press, :shift-button-press,
etc.) or by a function of the event stream (e.g. :double-click). But, CLOS
doesn't handle these kind of (sub)classes.
------ end
I'm not sure I understood it either. But if it means that you would like
to be able to have a predicate that controls whether a particular method
is applicable or not, like Common Lisp's SATISFIES type-specifiers or
guards in some other languages, CLOS doesn't have that, but it does have
something which gives about the same functionality: You can define your
own method-combination type, in which each method is optionally associated
with a predicate function, and the effective method form is a COND form
that calls the predicates and then calls the method for the first satisfied
predicate. Alternatively, you can use the builtin :OR method combination
type, and stick the predicates inside the bodies of the methods.
I hope this helps.