-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 9 Jul 2009, at 13:08, Robert Goldman wrote:
Greg Pfeil wrote:
Here are a couple changes to ASDF that I made in the process of creating an ASDF browser for CCL's IDE:
∙ system-source-file now works for systems without their own .asd ∙ optional parts of systems (version, maintainer, etc.) don't leave their slots unbound
The first of these looks good, but I'm less fond of the second change. I've been bitten repeatedly by bugs caused by initforms that caused slots not explicitly set to have some value that hides a mistaken failure to fill the slot.
Yeah, I should have sent these as separate patches. The first one is more important, IMO, and the second is definitely debatable.
I'd rather have us handle slot-unbound on those optional parts of the system instead of stuffing a bunch of NILs in there.
When you say "us", do you mean implementing the accessors explicitly in ASDF to handle the condition, or having the caller handle/avoid the condition?
If one is expecting strings here one must still handle checking for NIL, so having to check for slot-boundp doesn't seem that much more onerous.
Checking slot-boundp has a number of problems:
∙ you have to export the slot names ∙ it breaks the accessor abstraction because the slot names don't match the accessor names (when (slot-boundp foo 'asdf::description) (system-description foo)) ∙ it breaks the accessor abstraction again because not everything that follows the accessor pattern has a slot (when (slot-boundp foo 'asdf::pathname) (component-pathname foo))
The default value could just as well be "" as NIL. I chose NIL because you can kind of distinguish a system explicitly having "" as the value versus the case where the slot isn't set. If the distinction isn't worthwhile (which it probably isn't in this case, "" may be just as good.
On a related topic, I'd be inclined, more for documentation than efficiency, to stick :type string on a bunch of these. Of course, if I'm wrong about the above, this would have to be (or null string)....
Or use "" as the default.
Again, this is much less important to me than the system-source-file change (well, other than the fact that I'm loath to use non-exported symbols in CCL), so if that could be committed separately, I'd appreciate it. I'm happy to send a new diff with only those changes if that would help.