Quoth Peter Danenberg on Pungenday, the 59th of Bureaucracy:
> [C]an we revert to the old behaviour, or can I revert locally by
> using `set-read-syntax!'?

Fortunately or unfortunately, this hideous hack suffices to bring back
the 4.5.0 behaviour without permanently modifying the global
read-table:

  (define (call-with-read-syntax char-or-symbol proc thunk)
    (let ((old-read-table (copy-read-table (current-read-table))))
      (dynamic-wind
          (lambda () (void))
          (lambda ()
            (set-read-syntax! char-or-symbol proc)
            (thunk))
          (lambda () (set! current-read-table
                           (lambda () old-read-table))))))

  ;;; 4.5.0 behaviour: '\ => '\
  (call-with-read-syntax
   #\\
   (lambda (port) '\\)
   (lambda ()
     (with-input-from-string "'\\" read)))

  ;;; 4.6.0 behaviour: '\\ => '\
  (with-input-from-string "'\\\\" read)

I didn't see any mention of this change to the reader in NEWS; was it
intentional?

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to