hy icon indicating copy to clipboard operation
hy copied to clipboard

Trouble with `defreader` inside other forms

Open Kodiologist opened this issue 2 years ago • 0 comments

Consider

(do
  (defreader r 5)
  (print #r))

The result is LexException: reader macro '#r' is not defined. Perhaps defreader shouldn't be legal here in the first place, but what's checked in defreader is whether we're in the global scope, which we clearly are. What's more, that check doesn't seem to work, because the same error message as above is produced when you use a defn instead of do.

Kodiologist avatar Jun 07 '22 16:06 Kodiologist