guile-devel
[Top][All Lists]
Advanced

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

interesting bug


From: Andy Wingo
Subject: interesting bug
Date: Fri, 23 Oct 2009 10:42:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

I saw an interesting bug today. Can you guess the cause of this error?

ERROR: In procedure memoization:
ERROR: Bad formal address@hidden in expression (lambda (address@hidden) (apply 
(lambda
(#{filename\ 2520}# #{proc\ 2521}# #{reference\ 2522}#) (let
((#{template\ 2523}# (string-append #{filename\ 2520}# ".XXXXXX"))) (let
((#{tmp\ 2524}# #)) (call-once (lambda () #))))) address@hidden)).

The reason is that the expansion of

     `(cond (foo => (apply (lambda (args) ,x) args)))

Is something like

(list 'cond
      (list 'foo
            '=> (cons 'apply
                      (cons (list 'lambda '(args) x)
                            '(args)))))

The '(args) is duplicated, the compiler notices that, and stores it only
once. When the memoizer processes the '(args) *argument* it memoizes
args to point to its lexical location (address@hidden; I didn't show the let in
my example). But that side-effects the formals of the lambda too!

Yet another reason to replace the evaluator...

A
-- 
http://wingolog.org/




reply via email to

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