On Tue, Feb 4, 2014 at 12:04 AM, Marc Nieper-Wißkirchen < [email protected]> wrote:
> > Related to this is one paragraph in 5.1: > > It says: > > > > > > > *Import declarations and definitions cause bindings to be created in the > global environment or modify the value ofexisting global bindings. The > initial environment of a pro-gram is empty, so at least one import > declaration is neededto introduce initial bindings. * > First of all, when (outside of a REPL) is it possible for an import > declaration to modify (the value) of existing global bindings? Is this a > correct library? > > (import (scheme base)) > (begin > (define x 1)) > (import (only (other-lib) x) > > Or does it count against the fact that an imported binding is not allowed > to be redefined or mutated (although the identifier is not yet imported in > the begin form)? > This is an error as described in 5.2: [..] it is an error to import the same identifier more than once with different bindings, or to redefine or mutate an imported binding with a definition or with set! The order of the import and definition don't matter. Section 5.6.1 specifically lists two possible implementations of libraries, in one of which all imports are performed before the expressions from begin and include are expanded. -- Alex
_______________________________________________ Scheme-reports mailing list [email protected] http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports
