On 30 Dec 2010, at 01:05, Sam Steingold wrote:
- Pascal Costanza cp-99BKOWH6pVcrbJU0hmoH5j@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