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: pgphJntrlGJCR.pgp
Description: PGP signature

_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to