chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Modules and environments


From: Peter Bex
Subject: Re: [Chicken-users] Modules and environments
Date: Sun, 30 Aug 2009 19:38:13 +0200
User-agent: Mutt/1.4.2.3i

On Sun, Aug 30, 2009 at 07:20:33PM +0200, Thomas Chust wrote:
> Hello,
> 
> following your logic, the code
> 
>   (use environments)
> 
>   (eval
>     '(define-syntax hello (syntax-rules () [(hello) (print "hello")]))
>     (interaction-environment))
> 
>   (print
>     (environment-has-binding? (interaction-environment) 'hello))
> 
>   (eval
>     '(hello)
>     (interaction-environment))
> 
> should also fail in the fourth statement, since the third statement
> prints #f ...

I disagree. If this should print #t you should also be able to obtain
a reference to the macro using (eval 'hello (interaction-environment)),
but that's not possible since macros are not first-class.

It prints "Error: unbound variable". The error message is clear enough:
macros are not considered to be variable bindings, so logically,
environment-has-binding? should never return #t on macro names.
IMO this case is irrelevant to the behaviour with modules.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: pgpvZzwb0sEsi.pgp
Description: PGP signature


reply via email to

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