guile-devel
[Top][All Lists]
Advanced

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

Re: Strange memoizing behavior


From: Matthias Koeppe
Subject: Re: Strange memoizing behavior
Date: Tue, 22 Jan 2002 11:21:14 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (sparc-sun-solaris2.7)

Thien-Thi Nguyen <address@hidden> writes:

>    From: Matthias Koeppe <address@hidden>
>    Date: Thu, 17 Jan 2002 15:34:32 +0100
>
>    Shouldn't Guile report that the (FOO AND) form is bad?
>
> badness is up to the user to define -- passing macros may actually be
> useful sometimes.  to help distinguish, try:
>
>  (primitive-macro? and) => #t
>
> note that this relies on being able to pass the macro!

Indeed, we cannot disallow passing macros to functions because that
would effectively destroy their first-class status.

I would rather suggest that the evaluator allows a MACRO! in the
operator position of a form only to come from the global value of a
symbol, ruling out MACRO!s bound lexically and MACRO!s resulting from
a procedure/special form call.  So:

            (and ...)      ; ok, AND has a global binding
            
            (let ((foo and))
              (foo ...))   ; illegal (lexically bound MACRO!)

            ((lambda (foo) (foo ...))
             and)          ; illegal (lexically bound MACRO!)

            ((if (something?) or and)
             ...)          ; illegal, operator form had a MACRO! result

Would that be feasible in Guile's evaluator?  

-- 
Matthias Köppe -- http://www.math.uni-magdeburg.de/~mkoeppe



reply via email to

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