Re: Constructor -- lambda expression
"Eric M. Ludlam" <[email protected]> Wed, 02 Jun 2010 20:43:50 -0400
| Newsgroups | gmane.emacs.eieio |
|---|---|
| Message-ID | <[email protected]> |
On 05/29/2010 04:07 PM, Jan Moringen wrote:
> Hi Frank.
>
>> Another question:
>>
>> (defclass foo ()
>> ((bar :initform (lambda () (make-vector 10 nil)))))
>>
>> (make-instance 'foo)
>> ;; results in [object foo "foo" (lambda nil (make-vector 10 nil))]
>>
>> Isn't the lambda expression of the :initform supposed to be evaluated at
>> instantiation time?
>
> I'm not entirely sure, but I think that behavior has been obsoleted.
It used to do that, but it is non-standard, and RMS wanted it removed.
It is supposed to instead be something like:
(defclass foo ()
((bar :initform (make-vector 10 nil)))
but I haven't looked up the specifics of how that all is supposed to
work, nor tried to make it do the right thing.
Eric
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo