unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Set source property on an evaluated expression
@ 2005-05-31 18:56 Neil Jerram
  2005-06-06 20:08 ` Marius Vollmer
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Jerram @ 2005-05-31 18:56 UTC (permalink / 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Set source property on an evaluated expression
  2005-05-31 18:56 Set source property on an evaluated expression Neil Jerram
@ 2005-06-06 20:08 ` Marius Vollmer
  2005-06-07 19:18   ` Neil Jerram
  0 siblings, 1 reply; 3+ messages in thread
From: Marius Vollmer @ 2005-06-06 20:08 UTC (permalink / raw)
  Cc: bug-guile, guile-devel

Neil Jerram <neil@ossau.uklinux.net> writes:

> I propose that the SCM_NECONSP fix is good enough in practice, and
> would like to release it into 1.6.x. Any objections?

Not from me!

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Set source property on an evaluated expression
  2005-06-06 20:08 ` Marius Vollmer
@ 2005-06-07 19:18   ` Neil Jerram
  0 siblings, 0 replies; 3+ messages in thread
From: Neil Jerram @ 2005-06-07 19:18 UTC (permalink / raw)
  Cc: bug-guile, guile-devel

Marius Vollmer wrote:
> Neil Jerram <neil@ossau.uklinux.net> writes:
> 
> 
>>I propose that the SCM_NECONSP fix is good enough in practice, and
>>would like to release it into 1.6.x. Any objections?
> 
> 
> Not from me!
> 
OK, this fix is in now, as well as the new tests.

	Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-07 19:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-31 18:56 Set source property on an evaluated expression Neil Jerram
2005-06-06 20:08 ` Marius Vollmer
2005-06-07 19:18   ` Neil Jerram

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).