[Scheme-reports] EVAL Andre van Tonder (23 Apr 2011 23:47 UTC)
[Scheme-reports] What happened to (UNQUOTE <expression> ...) Andre van Tonder (24 Apr 2011 00:04 UTC)
[Scheme-reports] Are generated toplevel definitions secret? Andre van Tonder (24 Apr 2011 00:15 UTC)
[Scheme-reports] COND, CASE, AND, ... macros are buggy Andre van Tonder (24 Apr 2011 00:24 UTC)
[Scheme-reports] Buggy definition of BEGIN Andre van Tonder (24 Apr 2011 00:33 UTC)
Re: [Scheme-reports] Buggy definition of BEGIN Jussi Piitulainen (24 Apr 2011 06:55 UTC)
[Scheme-reports] Restrictions on internal BEGIN? Andre van Tonder (24 Apr 2011 01:45 UTC)
Re: [Scheme-reports] Restrictions on internal BEGIN? Jussi Piitulainen (24 Apr 2011 07:20 UTC)
[Scheme-reports] Toplevel import scoping Andre van Tonder (24 Apr 2011 02:02 UTC)
Re: [Scheme-reports] Toplevel import scoping Alex Shinn (24 Apr 2011 02:44 UTC)
Re: [Scheme-reports] Toplevel import scoping Aaron W. Hsu (29 Apr 2011 17:11 UTC)
Re: [Scheme-reports] Toplevel import scoping Aaron W. Hsu (29 Apr 2011 17:10 UTC)
Re: [Scheme-reports] Are generated toplevel definitions secret? Andre van Tonder (24 Apr 2011 15:53 UTC)
(missing)
(missing)
(missing)
Re: Are generated toplevel definitions secret? Aaron W. Hsu (24 May 2011 18:51 UTC)
Re: [Scheme-reports] Are generated toplevel definitions secret? Sztefan Edwards (25 May 2011 14:32 UTC)
Re: Are generated toplevel definitions secret? Aaron W. Hsu (25 May 2011 20:03 UTC)
Re: [Scheme-reports] Are generated toplevel definitions secret? Andy Wingo (07 Nov 2011 11:32 UTC)
Re: [Scheme-reports] Are generated toplevel definitions secret? Perry E. Metzger (07 Nov 2011 18:40 UTC)
Re: [Scheme-reports] Are generated toplevel definitions secret? Perry E. Metzger (07 Nov 2011 18:45 UTC)
Re: [Scheme-reports] What happened to (UNQUOTE <expression> ...) Andre van Tonder (24 Apr 2011 03:10 UTC)
Re: [Scheme-reports] EVAL Alex Shinn (24 Apr 2011 02:10 UTC)
Re: [Scheme-reports] EVAL John Cowan (24 Apr 2011 06:56 UTC)

Re: [Scheme-reports] Are generated toplevel definitions secret? Andy Wingo 07 Nov 2011 11:30 UTC

Hi,

On Tue 24 May 2011 23:10, Andy Wingo <wingo@pobox.com> writes:

>    (define-syntax define-const
>      (syntax-rules ()
>        ((_ name val)
>         (begin
>           (define t val)
>           (define-syntax name (syntax-rules () ((_) t)))))))
>
> Guile currently does not make the generated toplevel definition "t" have
> a fresh name.  It would be nice if it could but it can't be a really
> random name -- it needs to be predictable.
>
> Well why not have the name of "t" be "t" plus some string which depends
> only on the incoming form -- like its hash value.  (Or the outgoing
> form; the considerations are different but similar.)
>
> That way you do preserve the "compatible recompilation" aspect, trading
> off true secrecy, but hey.  Oh well.

FWIW, I have implemented this in Guile's master branch.

  > (define-const foo 10)
  > t-798f2ffcb9d7f9
  $1 = 10
  > (define-const bar 20)
  > t-
  t-1a0faae6e8559b31  t-798f2ffcb9d7f9

Here I used tab completion to show me the available bindings.

  > t-1a0faae6e8559b31
  $2 = 20

The appended uniquifiers are derived from the hash of the stripped
definition form, i.e. `(define t 10)'.  This means that there are still
some situations in which two bindings will collide -- as in:

   (define-syntax define-variable
     (syntax-rules ()
       ((_ name val)
        (begin
          (define t val)
          (define-syntax name
            (syntax-rules ()
              ((_) t)
              ((_ v) (set! t v))))))))

   (define-variable foo 10)
   (define-variable bar 10)
   (bar 20)
   (foo) => 20

I'm not really sure what the right thing is to do here.

Andy
--
http://wingolog.org/

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports