[bknr-devel] Deftransaction and &rest args
Hans Hübner
hans.huebner at gmail.com
Tue Dec 13 10:18:14 UTC 2011
Hi Vladimir,
thank you for reporting the deftransaction bug, which is a genuine
bug. I think it was introduced while Kilian worked on the code and
did not have tests to verify his changes. I'll take care of the
problem.
Cheers,
Hans
On Sat, Dec 10, 2011 at 10:52 PM, Vladimir Sedach <vsedach at gmail.com> wrote:
> Hi Hans,
>
> This is the smallest error scenario I have come up with:
>
> DATASTORE> (open-store "/home/viper/tmp/test-store/")
> initializing store random state
> restoring #<STORE DIR: "/home/viper/tmp/test-store/">
> #<STORE DIR: "/home/viper/tmp/test-store/">
> DATASTORE> (defclass test-object (store-object)
> ((test-slot :initform '(1 2 3)))
> (:metaclass persistent-class))
> #<PERSISTENT-CLASS TEST-OBJECT>
> DATASTORE> (slot-value (make-instance 'test-object) 'test-slot)
> (1 2 3)
> DATASTORE> (deftransaction set-test-slot (object &rest args)
> (setf (slot-value object 'test-slot) args))
> SET-TEST-SLOT
> DATASTORE> (slot-value (car (store-objects-with-class 'test-object)) 'test-slot)
> (1 2 3)
> DATASTORE> (set-test-slot (car (store-objects-with-class 'test-object)) 3 4 5)
> NIL
> DATASTORE> (slot-value (car (store-objects-with-class 'test-object)) 'test-slot)
> NIL
>
> Actually, looking in txn.lisp (line 422):
> ,@(let ((rest (member '&rest args)))
> (when rest `((declare (ignore ,(second rest))))))
>
> And line 427 when making the transaction, make-args is called during
> macroexpansion, which does the following:
>
> (make-args '(foo &rest bar)) => (FOO)
>
> This is why I assumed that &rest args were left out for a reason but
> warnings/documentation was just forgotten.
>
> Vladimir
>
> On Wed, Dec 7, 2011 at 3:40 AM, Hans Hübner <hans.huebner at gmail.com> wrote:
>> Hi Vladimir,
>>
>> I have looked at the source of deftransaction and the method
>> definitions for encode-object and decode-object for transactions - The
>> &rest arguments seem to be passed to the transaction object as :args
>> initarg, stored in the transaction file in the encoder and also read
>> back in the decoder. So, the intention is that they are recorded.
>> Did you see that not work?
>>
>> -Hans
>>
>> On Wed, Dec 7, 2011 at 4:36 AM, Vladimir Sedach <vsedach at gmail.com> wrote:
>>> Hello,
>>>
>>> Deftransaction permits &rest args, but they don't seem to be recorded
>>> in the store. Is the correct behavior that &rest args should not be
>>> valid in a deftransaction lambda-list, or is this a bug in storing
>>> them?
>>>
>>> Thanks,
>>> Vladimir
>>>
>>> _______________________________________________
>>> bknr-devel mailing list
>>> bknr-devel at common-lisp.net
>>> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/bknr-devel
More information about the Bknr-devel
mailing list