Jonathan Rees
2012-12-01 14:03:48 UTC
((eval (list 'quote (lambda () 'hello!)) (scheme-report-environment 5)))
Warning: invalid datum in quotation#{Procedure 8664}
(&warning)
'hello!
The spirit of the warning is correct, but there should be follow-through in the form of replacing the (quote ...) form with syntax error code, as happens with other static errors e.g.
(lambda ())
Warning: invalid expression(#{Name lambda} ())
(&syntax-error)
'syntax-error
(Better would be for a run-time error to result, not just a bogus value.)
The reasoning is the same as that for converting mutable to immutable values when they're quoted, and has to do with supporting cross-compilation and capability security applications. The prohibition is allowed by the Scheme reports (due to the specified syntax of the QUOTE special form).
Best
Jonathan