[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] Re: #505: permit user-defined read-syntax to restart
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] Re: #505: permit user-defined read-syntax to restart the reader |
Date: |
Thu, 17 Feb 2011 23:37:12 -0000 |
#505: permit user-defined read-syntax to restart the reader
-----------------------------+----------------------------------------------
Reporter: zbigniew | Owner: zbigniew
Type: enhancement | Status: new
Priority: minor | Milestone: 4.7.0
Component: core libraries | Version: 4.6.x
Resolution: | Keywords: don't fear the reader
-----------------------------+----------------------------------------------
Comment(by zbigniew):
Here's another possibility which I think is cleaner. It adds new starred
variants of {{{set-read-syntax!}}}, {{{set-parameterized-read-syntax!}}}
and {{{set-sharp-read-syntax!}}}, which take 2 arguments (p restart)
instead of just (p). Invoking (restart) will restart the reader, like if
you had returned zero values in the previous patch. E.g.
{{{
;; instead of
(set-read-syntax! #\! (lambda (p) (read-line p) (values)))
;; we can use
(set-read-syntax!* #\! (lambda (p restart) (read-line p) (restart)))
;; then
(list 'foo ! 'bar 'baz
'quux)
; => (foo quux)
}}}
The starred names are ugly, I also thought of {{{set-restartable-read-
syntax!}}}, {{{set-restartable-sharp-read-syntax!}}} and {{{set-
restartable-parameterizable-read-syntax!}}} but it gets ridiculously long.
(To be fair, I doubt parameterizable read syntax will need a restartable
variant.)
Only thing this doesn't do is allow calls to {{{##sys#user-read-hook to
restart}}}, but I can live with that!
--
Ticket URL: <http://bugs.call-cc.org/ticket/505#comment:2>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.