[Openmcl-devel] User contributions
Robert Goldman
rpgoldman at sift.info
Sat Jun 13 18:50:24 PDT 2009
Ron Garret wrote:
> On Jun 12, 2009, at 2:03 PM, Ron Garret wrote:
>
>> On Jun 12, 2009, at 1:39 PM, Ron Garret wrote:
>>
>>>> Does your code perhaps lack some (eval-when ...)
>>>>
>>> Undoubtedly. Like I said, it's not quite ready for inclusion in
>>> contribs.
>> BTW, a workaround until I get around to fixing this if you really want
>> fasl files is to load everything first and then compile the files.
>
> And just in case anyone actually tried this, it won't work. The
> reason is that I'm doing (essentially) this:
>
> (defconstant +guardian+ (gensym))
>
> as part of my iterators code. But it turns out this is a broken idiom
> because, as Gary points out in http://trac.clozure.com/ccl/ticket/539:
>
> The spec says:
>
> "If a defconstant form appears as a top level form, the compiler must
> recognize that name names a constant variable. An implementation may
> choose to evaluate the value-form at compile time, load time, or both.
> Therefore, users must ensure that the initial-value can be evaluated
> at compile time (regardless of whether or not references to name
> appear in the file) and that it always evaluates to the same value."
>
>
> I am open to suggestions on how to fix this because this leave me at a
> bit of a loss.
Is it possible to write a macro that will look to see whether the
+guardian+ is already bound and, if it is, keep the old binding,
otherwise bind it by invoking gensym?
This is pretty much what the define-constant macro (in the
"Idiosyncracies"/"defining constants" section of the SBCL info file) does.
Best,
r
More information about the Openmcl-devel
mailing list