[R6RS] safe and unsafe; declarations

dyb at cs.indiana.edu dyb at cs.indiana.edu
Sat Mar 4 14:49:46 EST 2006


> Right.  What bothers me is the idea that any macro I import
> from a library might transform the (safe 3) declarations in
> my code into (safe 0) declarations.  After thinking about it
> some more, I realize that syntax-case allows library macros
> to do that even without your proposed identifier-priority.

You don't need syntax-case for that---syntax-rules macros can do the same
thing.  An identifier-priority procedure doesn't make doing so any easier. 
My point was simply that a library's exports can always use unsafe code
without proving that it's okay to do so, even if you've declared (safe 3). 
If we provide an identifier-priority procedure that can be used, among
other things, to determine the safety level, there's no excuse.

> What bothers me the most, though, is my concern that unsafe
> mode will be perceived as a major misfeature of the R6RS,
> and not as an improvement over the R5RS.  In my view, the
> point of unsafe mode should be to allow the R6RS to talk
> as though certain exceptions are actually required, not to
> serve as a constant reminder that you can't rely on that.

I don't believe including identifier-priority adds to this potential
perception problem.  An "identifier-unsafe?" predicate might, but
identifier-priority isn't limited to checking for unsafe mode.  Perhaps an
example like the following instead of the one I provided earlier would
help.

(define-syntax make-looker
  (lambda (x)
    (syntax-case x ()
      [(k base limit f)
       (if (and (>= (identifier-priority 'fast #'k) 2)
                (<= (identifier-priority 'small #'k) 1))
           #'(make-table-looker base limit f)
           #'(make-direct-looker base limit f))])))

Kent



More information about the R6RS mailing list