Discussion:
"invalid datums in quotation" should be suppressed
Jonathan Rees
2012-12-01 14:03:48 UTC
Permalink
((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
Michael Sperber
2012-12-27 16:27:21 UTC
Permalink
Post by Jonathan Rees
((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).
For now, I'm going to to treat this the same way as `(lambda ())', which
is by calling `syntax-violation'. This makes it a hard error rather
than a warning, with the possibility of deferring until run-time later.
--
Regards,
Mike
Loading...