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

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

On Mon, Feb 3, 2014 at 7:44 PM, Taylan Ulrich Bayırlı/Kammer <taylanbayirli@x> wrote:
Marc Nieper-Wißkirchen <marc.nieper@x> writes:

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

I think it is intended that accessing y
> in the top-level program still yields 12 (at least this is, what
> chibi-scheme does, with which I am experimenting), and which would
> allow a number of optimizations at compile-time. [If I understand
> correctly, it is only forbidden to mutate an imported binding, not an
> exported one.]

My answer is not authoritative, but I would say that you can safely
assume the intention to be the sharing of the location, i.e. the change
should be visible.

Unfortunately implementations differ here, and the
goal was that R7RS libraries be able to map directly
to native implementation libraries.

That being said, I have no idea why Chibi behaves the way you describe,
maybe my assumption is not as safe as I thought.

This is an artifact of pre-R7RS semantics in Chibi.  It
can be configured at compile time such that there is
only one binding, and Marc's test program will print 12
then 13.  Probably I should make this the default
configuration (the "strict" keyword matching option
mentioned earlier actually forces this).


Scheme-reports mailing list