diff options
-rw-r--r-- | share/txr/stdlib/place.tl | 14 | ||||
-rw-r--r-- | txr.1 | 26 |
2 files changed, 18 insertions, 22 deletions
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl index 63d855a9..5b22e589 100644 --- a/share/txr/stdlib/place.tl +++ b/share/txr/stdlib/place.tl @@ -809,20 +809,18 @@ (:postinit (cons (op struct-get-postinitfun struct) (op struct-set-postinitfun struct))) (t (cons (op static-slot struct slot) - (op static-slot-set struct slot)))) + (op static-slot-ensure struct slot)))) :)) ((type sym) (if (eq type 'macro) - (let ((cell (gethash sys:top-mb sym))) - (unless cell - (sys:eval-err "unbound macro ~s" sym)) + (let ((cell (or (gethash sys:top-mb sym) + (sethash sys:top-mb sym (cons sym nil))))) (cons (op cdr) (op sys:rplacd cell))) :)) (else - (let ((cell (gethash sys:top-fb sym))) - (unless cell - (sys:eval-err "unbound function ~s" sym)) + (let ((cell (or (gethash sys:top-fb sym) + (sethash sys:top-fb sym (cons sym nil))))) (cons (op cdr) (op sys:rplacd cell)))))) @@ -856,7 +854,7 @@ (defun sys:get-vb (sym) (or (gethash sys:top-vb sym) - (sys:eval-err "unbound variable ~s" sym))) + (sethash sys:top-vb sym (cons sym nil)))) (defplace (symbol-value sym-expr) body (getter setter @@ -16028,24 +16028,22 @@ and a binding denoted by is removed using .codn makunbound . -If one of these three accessors is applied to a -.meta symbol -which doesn't have a binding in the respective namespace corresponding -to that accessor, then the form denotes a nonexistent place. An attempt to store -a value to this place results in an exception being thrown. - -Deleting such a nonexistent place doesn't throw an exception. -If a nonexistent place is deleted using the -.code del -macro, nothing happens, and instead of the prior value -of the place, which doesn't exist, the macro yields -the value -.codn nil . - Deleting a method via .code symbol-function is not possible; an attempt to do so has no effect. +Storing a value, using any one of these three accessors, to a nonexistent +variable, function or macro binding, is not erroneous. It has has the effect of +creating that binding. + +Deleting a binding, using any of these three accessors, when the binding does not +exist, also isn't erroneous. There is no effect and the +.code del +operator yields +.code nil +as the prior value, consistent with the behavior when accessors are used to +retrieve a nonexistent value. + .TP* "Dialect note:" In ANSI Common Lisp, the |