On 20-09-2022 09:23, Andrew Whatson wrote:
=> (lambda (binding) - (let ((val (frame-local-ref frame (binding-slot binding) - (binding-representation binding)))) + (let* ((slot (binding-slot binding)) + ;; HACK: Avoid out-of-range from frame-local-ref. + ;; Some frames have bindings beyond nlocals. That + ;; is probably a bug somewhere else, but at least + ;; this workaround allows them to be printed. + (val (if (< slot nlocals) + (frame-local-ref frame slot + (binding-representation binding)) + ;; else #<unspecified > + )))
I propose to add a link to the bug report in the comments, for future reference. Also, there is an interest in returning zero values in such cases: <https://www.mail-archive.com/bug-guile@gnu.org/msg07927.html> (that patch didn't work out, but the sentiment is still there).
As such, I recommend being explicit: (if [...] [...] *unspecified*) Greetings, Maxime.
OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature