[pro] macros expanding to defclass + some mop code

Pascal Costanza pc at p-cos.net
Thu Dec 30 19:12:43 UTC 2010


On 30 Dec 2010, at 01:05, Sam Steingold wrote:

>> * Pascal Costanza <cp-99BKOWH6pVcrbJU0hmoH5j at choyvp.tznar.bet> [2010-12-29 21:37:44 +0100]:
>> 
>> Just to be complete, I insist that the 'right' way to do this is to do
>> this at runtime.
> 
> I found Martin's solution - moving the MOP code into an outside macro,
> thus moving the MOP function calls from read time to macroexpansion time
> - to be the most elegant and simple.

I wasn't trying to criticize Martin's solution - it is probably the best solution for many situations. That's why I put the word 'right' in quotation marks.

I only wanted to call attention to the fact that doing such things at runtime is more in line with how the CLOS MOP (and CLOS for that matter) is designed, which is as a runtime metaobject protocol. For example, there can be circumstances where the two classes that Martin's solution creates may not match and may be different at compile time and runtime. The solution I proposed last avoids that by having exactly one class definition. However, such cases are unlikely to occur in practice, so this is likely just an academic exercise. Nevertheless, I think it's important to mention this just for the sake of completeness.

I hope this is clearer now.

Best,
Pascal

-- 
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel
Software Languages Lab
Pleinlaan 2, B-1050 Brussel, Belgium










More information about the pro mailing list