From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.bugs,gmane.lisp.guile.devel Subject: Set source property on an evaluated expression Date: Tue, 31 May 2005 19:56:43 +0100 Message-ID: <429CB36B.7060406@ossau.uklinux.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1117566061 16918 80.91.229.2 (31 May 2005 19:01:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 May 2005 19:01:01 +0000 (UTC) Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue May 31 21:00:52 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DdBwJ-0002u8-OS for guile-bugs@m.gmane.org; Tue, 31 May 2005 20:58:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DdC1S-0003fA-6e for guile-bugs@m.gmane.org; Tue, 31 May 2005 15:03:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DdC0m-00035b-IN for bug-guile@gnu.org; Tue, 31 May 2005 15:02:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DdC0i-00032E-Or for bug-guile@gnu.org; Tue, 31 May 2005 15:02:45 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DdC0e-00030b-1L; Tue, 31 May 2005 15:02:40 -0400 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DdBwx-0003WR-GA; Tue, 31 May 2005 14:58:51 -0400 Original-Received: from laruns (host81-130-111-97.in-addr.btopenworld.com [81.130.111.97]) by mail3.uklinux.net (Postfix) with ESMTP id 33A3240A00C; Tue, 31 May 2005 18:56:58 +0000 (UTC) Original-Received: from [127.0.0.1] (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 49BDC6F744; Tue, 31 May 2005 19:56:45 +0100 (BST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en Original-To: bug-guile@gnu.org, guile-devel X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:3022 gmane.lisp.guile.devel:5058 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:5058 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 [...] * 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