From: Hoehle, Joerg-C. <Joe...@t-...> - 2005-03-30 12:34:43
|
[feature request sent here for discussion] Hi, Sometimes I think EXT:LETF is a nifty macro. Mostly I would consider using it with hash tables. However it does not restore hash table entries correctly (how is that defined anyway?) in the case where the key was not present before: (let((h(make-hash-table))) (ext:letf (((gethash 1 h) 2)) (princ(gethash 1 h))) (gethash 1 h)) prints 2 and yields NIL ; T I'd expect nil; nil as result. I wonder whether ext:LETF resp. get-setf-expander can accomodate such behaviour or whether it's really gethash that needs special treatment. Here's the behaviour I would expect for hash tables: (multiple-value-bind (found old) (gethash...) (setf (gethash ...) new) (unwind-protect body (if found (setf (gethash ...) old) (remhash key table)))) Regards, Jorg Hohle. |