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: Thomas Chust
Subject: Re: [Chicken-users] Modules and environments
Date: Sun, 30 Aug 2009 16:42:43 +0200

2009/8/30 Peter Bex <address@hidden>:
> [...]
> (import test)
>
> (use environments)
> (print (environment-has-binding? (interaction-environment) 'hello))
>
> This prints #f, whereas I would have expected it to print #t, since
> defining a module and importing should be identical to putting the
> module's body in the file.
> [...]

Hello,

I think importing a module and pasting its code into another context
are not equivalent: The module definition itself sets up bindings in
the environment while the import establishes a mapping between
identifiers used in the code and in the execution environment. This
mapping is purely syntactic and can't be queried by examining the
runtime content of the environment datastructure.

Ciao,
Thomas


-- 
All these theories, diverse as they are, have two things in common: They
explain the observed facts, and they are completely and utterly wrong.
                               -- Terry Pratchett, "The Light Fantastic"




reply via email to

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