[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Strange memoizing behavior
From: |
Matthias Koeppe |
Subject: |
Strange memoizing behavior |
Date: |
Thu, 17 Jan 2002 15:34:32 +0100 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (sparc-sun-solaris2.7) |
If one passes a macro where a procedure is expected, this may seem to
work, but Guile's macro memoizing behavior will bite you afterwards.
I came across this problem today when a co-worker passed AND (a
PRIMITIVE-MACRO!) to the REDUCE procedure of (SRFI SRFI-1).
It boils down to this:
(define (foo procedure)
(procedure 1 2 3))
(foo list) ; returns (1 2 3)
(foo and) ; Guile returns 3 and memoizes `procedure'=`and' in `foo'
; but it should signal an error (improper use of macro?)
(foo list) ; now returns 3 too!
(procedure-source foo) ; returns (lambda (procedure) (and 1 2 3))
This is a nightmare to debug because the bad (FOO AND) form succeeds
but destructively modifies the FOO procedure.
Shouldn't Guile report that the (FOO AND) form is bad?
This is Guile 1.5.4, in case it matters.
--
Matthias Köppe -- http://www.math.uni-magdeburg.de/~mkoeppe
- Strange memoizing behavior,
Matthias Koeppe <=
- Re: Strange memoizing behavior, Thien-Thi Nguyen, 2002/01/21
- Re: Strange memoizing behavior, Matthias Koeppe, 2002/01/22
- Re: Strange memoizing behavior, Michael Livshin, 2002/01/22
- Re: Strange memoizing behavior, Rob Browning, 2002/01/24
- Re: Strange memoizing behavior, Matthias Koeppe, 2002/01/24
- Re: Strange memoizing behavior, Michael Livshin, 2002/01/24
- Re: Strange memoizing behavior, Matthias Koeppe, 2002/01/24
- Re: Strange memoizing behavior, Michael Livshin, 2002/01/24
- Re: Strange memoizing behavior, Marius Vollmer, 2002/01/24
- Re: Strange memoizing behavior, Thien-Thi Nguyen, 2002/01/25