[Top][All Lists]

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

Re: Guile: What's wrong with this?

From: Andy Wingo
Subject: Re: Guile: What's wrong with this?
Date: Wed, 04 Jan 2012 13:43:14 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

On Wed 04 Jan 2012 13:31, Mark H Weaver <address@hidden> writes:

> Andy Wingo <address@hidden> writes:
>> We could add a compiler option to turn string literals into (string-copy
>> FOO).  Perhaps that's the thing to do.
> I think this would be fine, as long as the default is _not_ to copy
> string literals.  This would help Bruce a great deal with very little
> effort on our part, without mucking up the semantics for anyone else.

Yes, this was what I was thinking.

> David Kastrup <address@hidden> writes:
>> What for?  It would mean that a literal would not be eq? to itself, a
>> nightmare for memoization purposes.
> I agree that it should not be the default behavior, but I don't see the
> harm in allowing users to compile their own code this way.

Well, we can fix this too: we can make


transform to

  (copy-once UNIQUE-GENSYM str)


(define (copy-once key str)
  (or (hashq-ref mutable-string-literals key)
      (let ((value (string-copy str)))
        (hashq-set! mutable-string-literals key value)


reply via email to

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