Open phmarek opened 10 months ago
Hi, wdyt of this?
(incf (or (accesses …)
0))
Well, to be honest, I don't like it.
(let ((x (make-hash-table)))
(incf (or (gethash 1 x) 0)))
doesn't work either (at least in SBCL), and it reads like (incf 0)
which hurts my eyes. Sorry.
The point is that the read-form and the write-form of access:accesses
need to be different, right?
If we follow the gethash
example, in (incf (gethash 1 x 0))
the 0
default value is evaluated and possibly discarded if the hash table already has a value. I assume that modifying accesses with a default would need to work the same way in order to maintain the semantics of "the place should look the same no matter if we read or write from it".
Currently it's not possible to run
because the initial value is
NIL
, which can't be incremented.How about allowing this here?