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

Re: [Scheme-reports] Identifiers imported "by reference or value"?



 
> What is supposed to happen if in the running program a call into the
> library performs (set! x 13)?

The result is unspecified.  It would probably be better
if we had specifically said so.  Note even mutation of
non-exported top-level bindings is unspecified in the
presence of multiple library loadings.

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 of
existing global bindings. The initial environment of a pro-
gram is empty, so at least one import declaration is needed
to 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)?

In case, this library is allowed by the standard, the quoted paragraph from 5.1 as written means that the import declaration (import (only (other-lib) x)) modifies the value of x. But this won't work if an implementation is allowed to bind an imported identifier to the same location as the exported identifier is bound to, because this would change the location x is bound to and not the value of the location x is currently bound to.

Marc
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports