Re: [CLOS] Ensuring a method exists
- From: Pascal Costanza <pc@xxxxxxxxx>
- Date: Wed, 27 Sep 2006 21:00:53 +0200
Ken Tilton wrote:
Now maybe that is what is going on and the OP is just leveraging CLOS as a convenient internal tool to the larger API, but then that is why I suggest going /further/ and hide the CLOS behind some macrology, at which point the OP can enforce anything they want really really easily (instead of staring at AMOP looking for support for something not really OO-able).
Both macros and the CLOS MOP are means to do metaprogramming. The distinction is that macros can be used for compile-time processing of code [1], while the CLOS MOP is useful for meta-programs that require special actions at runtime. Of course, it is always possible to make macros generate the code that takes care of the runtime issues, but it can be more convenient to rely on the MOP protocols, especially if you want to reuse major parts of the already existing functionality in CLOS.
Didier's example is actually a good one for the latter because you can delay the check whether methods are "properly" specialized until the latest possible stage, something that is not very easy to achieve with macros. That's similar to deferring class precedence lists, or the update protocols for changed or redefined classes, etc.
Pascal
[1] More correctly, "processing of code at macroexpansion time", but for most practical purposes, that's the same as compile time.
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
.
- Follow-Ups:
- Re: [CLOS] Ensuring a method exists
- From: Ken Tilton
- Re: [CLOS] Ensuring a method exists
- References:
- [CLOS] Ensuring a method exists
- From: Didier Verna
- Re: [CLOS] Ensuring a method exists
- From: Lars Rune Nøstdal
- Re: [CLOS] Ensuring a method exists
- From: Didier Verna
- Re: [CLOS] Ensuring a method exists
- From: Ken Tilton
- Re: [CLOS] Ensuring a method exists
- From: Christophe Rhodes
- Re: [CLOS] Ensuring a method exists
- From: Ken Tilton
- [CLOS] Ensuring a method exists
- Prev by Date: Re: [CLOS] Ensuring a method exists
- Next by Date: Re: [CLOS] Ensuring a method exists
- Previous by thread: Re: [CLOS] Ensuring a method exists
- Next by thread: Re: [CLOS] Ensuring a method exists
- Index(es):
Relevant Pages
|