From: Neil Jerram <neil@ossau.uklinux.net>
Subject: Set source property on an evaluated expression
Date: Tue, 31 May 2005 19:56:43 +0100 [thread overview]
Message-ID: <429CB36B.7060406@ossau.uklinux.net> (raw)
In 1.6.7, given these tests -
(with-test-prefix "set-source-property!"
(read-enable 'positions)
(let ((s (read (open-input-string "(display \"\")"))))
(pass-if "set-source-property! before eval"
(set-source-property! s 'test-sym 10)
(eval s the-scm-module)
#t)
(pass-if "set-source-property! after eval"
(hash-fold (lambda (x props acc)
(if (eq? (source-property x 'test-sym) 10)
(set-source-property! x 'test-sym 11)))
0
source-whash)
#t)))
- the second test fails because set-source-property! throws a
wrong-type-arg exception, which is because the car of x has been
memoized to a gloc: in other words, x is now (#@display ""), not
(display "").
A fix is to change the 3 occurrences of SCM_NCONSP in srcprop.c to
SCM_NECONSP, as SCM_ECONSP allows both normal pairs and those in which
the car is a gloc, whereas SCM_CONSP only allows normal pairs. However,
comments in the 1.6 code suggest that the design w.r.t. glocs is that
they should never be visible on the Scheme level, so this may not be the
best fix. Instead, the real problem theoretically speaking may be that
the source-whash (which is Scheme-accessible) contains glocs.
I suspect that it would be hard to remove glocs from the source-whash.
Given that the source-whash is only of interest to people writing
debugging tools (i.e. probably just me), I propose that the SCM_NECONSP
fix is good enough in practice, and would like to release it into 1.6.x.
Any objections?
(In 1.8 glocs have been removed, so I presume there is no analogous
problem there.)
(Curiously, the first quarter of this fix was made in 1999:
1999-09-12 Mikael Djurfeldt <mdj@thalamus.nada.kth.se>
[...]
* srcprop.c (scm_source_property): Bugfix: Use SCM_NECONSP instead
of SCM_NCONSP. (Thanks to Greg Badros.)
)
Neil
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile
next reply other threads:[~2005-05-31 18:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-31 18:56 Neil Jerram [this message]
2005-06-06 20:08 ` Set source property on an evaluated expression Marius Vollmer
2005-06-07 19:18 ` Neil Jerram
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=429CB36B.7060406@ossau.uklinux.net \
--to=neil@ossau.uklinux.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).