Prev: [ANN] Filtered functions
Next: Filtered functions.
From: Raffael Cavallaro on 5 Dec 2009 13:59 On 2009-12-05 01:05:42 -0500, Kenneth Tilton <kentilton(a)gmail.com> said: > Filed under "Stupid CLOS Tricks". Kenny's rant filed under "sour grapes." -- Raffael Cavallaro
From: Ron Garret on 5 Dec 2009 14:10 In article <7ntfj7F3m9fjiU1(a)mid.individual.net>, Pascal Costanza <pc(a)p-cos.net> wrote: > Filtered functions are an extension of generic functions, extended with > a filtering step where the arguments received by a generic function are > mapped to other values based on user-defined mapping functions. Those > filtered values are then used to perform the actual selection and > execution of applicable methods. Nevertheless, the methods that are > eventually executed see the original objects as received by the generic > function, and not the filtered ones. I like this concept, but is there a reason you designed the API the way you did instead of simply providing a facility for subclassing built-in classes? In other words, why not simply do: (def-subclass positive-integer integer 'plusp) (defmethod factorial ((n positive-integer)) ...) That would seem to me to provide the same functionality, and would make code using this feature easier to write and debug. rg
From: Kenneth Tilton on 5 Dec 2009 14:32 Raffael Cavallaro wrote: > On 2009-12-05 01:05:42 -0500, Kenneth Tilton <kentilton(a)gmail.com> said: > >> Filed under "Stupid CLOS Tricks". > > Kenny's rant filed under "sour grapes." Because you established somehow that I wished I had written Filtered Functions? Or do you not know the term "sour grapes"? God, I hope it's the latter. kt -- http://thelaughingstockatpngs.com/ http://www.facebook.com/pages/The-Laughingstock/115923141782?ref=nf
From: Pascal Costanza on 5 Dec 2009 14:49 Ron Garret wrote: > In article <7ntfj7F3m9fjiU1(a)mid.individual.net>, > Pascal Costanza <pc(a)p-cos.net> wrote: > >> Filtered functions are an extension of generic functions, extended with >> a filtering step where the arguments received by a generic function are >> mapped to other values based on user-defined mapping functions. Those >> filtered values are then used to perform the actual selection and >> execution of applicable methods. Nevertheless, the methods that are >> eventually executed see the original objects as received by the generic >> function, and not the filtered ones. > > I like this concept, but is there a reason you designed the API the way > you did instead of simply providing a facility for subclassing built-in > classes? In other words, why not simply do: > > (def-subclass positive-integer integer 'plusp) > > (defmethod factorial ((n positive-integer)) ...) > > That would seem to me to provide the same functionality, and would make > code using this feature easier to write and debug. Maybe this would work for this particular example (but factorial is really not that interesting now, is it? ;). Just check the other examples as well, I don't think you could solve them that easily. Pascal -- My website: http://p-cos.net Common Lisp Document Repository: http://cdr.eurolisp.org Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Raffael Cavallaro on 5 Dec 2009 15:00
On 2009-12-05 14:32:05 -0500, Kenneth Tilton <kentilton(a)gmail.com> said: > Because you established somehow that I wished I had written Filtered > Functions? Or do you not know the term "sour grapes"? Because I established through reading both Pascal's paper and the documentation for cells, and by noting the underwhelming reception cells has received over the years, that Pascal C. has written a very useful, well documented, widely portable CLOS extension for which he will be justly praised, and your CLOS extension, cells, uh, not so much... IOW, you don't wish that you had written filtered-functions, but rather that cells were as well documented and well received as filtered-functions will be. Finally, if the two of you (i.e., Kenny and Pascal C.) can stop bickering for a moment, you'd realize that a dataflow framework and a predicate dispatch framework together (with a little macro syntactic sugar) would allow completely declarative programming. -- Raffael Cavallaro |