[R6RS] Safe/unsafe mode

William D Clinger will at ccs.neu.edu
Tue Jul 11 22:36:31 EDT 2006


Concerning an example, Kent asked:
> Is the call (car x) unsafe code?

In my view, yes.

I see both value and simplicity in what you probably
regard as a hygiene-breaking rule.  If and when you
post a more complete statement of your semantics, I
will explain how your semantics also runs afoul of
one's intuition with respect to hygiene, and will
argue that the simpler semantics is more intuitive
and more useful.

> If map is passed the procedure - and the list (a), from code that is not
> unsafe code, and the two calls to type-check return without doing
> anything, must the call to - resulting from (p (car ls)) raise an
> exception because - receives a nonnumeric argument, or are all bets off?

I would say that all bets are off.  That may surprise
you, but consider how the MLton compiler represents
higher order procedures, and consider how that might
interact with even your preferred semantics.

In practice, with all Scheme compilers I know of, the
- procedure would probably raise an exception.  This
gets back to Mike's question about importing - from
a safe version of the library in which it is defined.
That would give the behavior you and Mike expect in
practice, but it is implementation-dependent in theory,
and the MLton compiler shows why.

Will



More information about the R6RS mailing list