1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 09:10:22 +02:00

Use a fluid for the list of the reader's "hash procedures"

This allows customizing the reader behavior for a dynamic extent more easily.

* libguile/read.c (scm_read_hash_procedures): Renamed to
  `scm_i_read_hash_procedures'.
  (scm_i_read_hash_procedures_ref, scm_i_read_hash_procedures_set_x):
  New (internal) accessor functions for the fluid.
  (scm_read_hash_extend, scm_get_hash_procedure): Use these accessor
  functions.
  (scm_init_read): Create the fluid, named `%read-hash-procedures' instead of
  the previous plain list `read-hash-procedures'.

* test-suite/tests/reader.test: Adapt the "R6RS/SRFI-30 block comment
  syntax overridden" test to make use of the fluid.

* module/ice-9/deprecated.scm (read-hash-procedures):
  New identifier macro -- backward-compatibility shim.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Andreas Rottmann 2010-11-03 00:09:57 +01:00 committed by Ludovic Courtès
parent 6887d0a1c6
commit d458073bc0
3 changed files with 52 additions and 24 deletions

View file

@ -65,7 +65,8 @@
save-stack
named-module-use!
top-repl
turn-on-debugging))
turn-on-debugging
read-hash-procedures))
;;;; Deprecated definitions.
@ -682,3 +683,17 @@ it.")
"Debugging capabilities are present by default.")
(debug-enable 'backtrace)
(read-enable 'positions))
(define (read-hash-procedures-warning)
(issue-deprecation-warning
"`read-hash-procedures' is deprecated."
"Use the fluid `%read-hash-procedures' instead."))
(define-syntax read-hash-procedures
(identifier-syntax
(_
(begin (read-hash-procedures-warning)
(fluid-ref %read-hash-procedures)))
((set! _ expr)
(begin (read-hash-procedures-warning)
(fluid-set! %read-hash-procedures expr)))))