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

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



On Tue, Feb 4, 2014 at 4:16 PM, Marc Nieper-Wißkirchen <marc.nieper@x> 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 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.

  [..] 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.

Great! This means that my problematic example does not work, which is good.

Which leaves the question to which situations the possibility of modifying an existing global binding as mentioned in the quoted paragraph from 5.1. actually applies.

The only place left, which you already pointed out, the REPL.

Note also this is an implementation detail.  As the passage states,
it _may_ modify _or_ create, but the programmer can't assume either.

Specifically section 5.7 discusses the REPL, and the possibility
of implementations for which all possible variables are already
bound to locations.  Both of these passages come from R5RS,
in deference to such implementations.

-- 
Alex

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