vseloved / rutils

Radical Utilities for Common Lisp
Other
246 stars 36 forks source link

Possible improvement to generic-elt on objects #28

Open jasom opened 8 years ago

jasom commented 8 years ago

From your blog post:

Still, one issue remains unsolved in this approach: the preferred Lisp slot-access method is not via slot-value, but with an accessor method that is exported

given that the preferred method is with an accessor, why not allow something like:

(? obj #'accessor-fn)

vseloved commented 8 years ago

Yes, this sounds reasonable. I'll add this in the next update. Also, patches are welcome :)

jcguu95 commented 2 months ago

Unfortunately, I think this is not possible unless we break API. One counter example is

(let ((accessor (lambda (ht) (gethash :a ht)))) 
  (? #h(accessor 0 :a 1) accessor))

If the it works in the new semantics, it should return 1. However, in the old semantics it returns 0.

I suggest to close this issue.