guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unsafe psyntax label generation


From: Andy Wingo
Subject: Re: Unsafe psyntax label generation
Date: Tue, 24 Jan 2012 22:27:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

On Tue 24 Jan 2012 15:01, Mark H Weaver <address@hidden> writes:

> `local-eval' combines syntax objects from two different sessions into a
> single syntax object (in the wrapper procedure), and thus there may be
> label name collisions.  Now, if this combined syntax object is
> serialized as a compiled procedure, these labels with the same name will
> be optimized together into the same string object!

A very good point!

Cf. Aziz's psyntax/expander.ss from r6rs-libraries.dev:

  ;;; (two marks must be eq?-comparable, so we use a string
  ;;; of one char (this assumes that strings are mutable)).
  
  ;;; gen-mark generates a new unique mark
  (define (gen-mark) ;;; faster
    (string #\m))

  ;;; every identifier in the program would have a label associated
  ;;; with it in its substitution.  gen-label generates such labels.
  ;;; the labels have to have read/write eq? invariance to support 
  ;;; separate compilation.
  (define gen-label
    (lambda (_) (gensym)))

His gensyms are globally unique; he made the exact opposite choice that
I did in the fd5985271fee3bcb6a290b6ad10525980a97ef8d; interesting.  I
wonder who is right here.

> Maybe there's something I'm missing here, but if the change you made
> above was safe, I think the burden of proof is on you to explain why.

Indeed, and I think you found a good indication that it's not right.

Andy
-- 
http://wingolog.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]