by Ramarren » Fri Jan 23, 2009 9:56 am
From what I have seen there are two solutions to this kind of problems. Well, maybe three, since the first thing you should consider is thinking not in terms of objects, but generic functions, or protocols in general. Doing the same operation on every slot in an object should be pretty rare, because it means that either the operation is highly generic, and there are only so many of those, like serialization, and for most of those there are libraries already, or the data in an object is highly homogeneous, in which case a different data structure might be better.
Anyway, as I said, there are two approaches here. One is, as I pointed in the post above, to use MOP. The other is to write your own defclass-like macro, which will save the slots list somewhere. Using MOP is more elegant, but then you probably will want to read AMOP, and in some implementations MOP is spotty.