On Mon, 25 Nov 2013 12:24:23 +0100, "Jörg F. Wittenberger"
<[email protected]> wrote:
> Hi all,
>
> I'm just making my first experiences in actually using srfi-110.
>
> At this point I find myself forced to make serious changes to the
> program logic. Beyond what's supported by simply configuring the source
> code.
>
> The worst thing I found that it will complain on the error port when
> reading badly formatted code and then continue to read. I really,
> really need it to do what other Scheme readers usually do: error out.
Easily done, and there are many ways to do it.
The ONLY procedure that throws an exception is "read-error":
(define (read-error message)
(display "Error: " (current-error-port))
(display message (current-error-port))
(newline (current-error-port))
(flush-output-port (current-error-port))
(raise 'readable)
'())
The ONLY procedure that catches an exception is t-expr-catch:
(define (t-expr-catch port)
(init-sweet)
(guard
(exception
((eq? exception 'readable)
(read-to-unindented-line port) (t-expr-catch port)))
(t-expr port)))
> What's even worse: simply complaining and the *continue to read* as if
> nothing had happened results in strange, stupid and wrong messages from
> the interpreter caught later. Example: an error in (define x ..) ends
> up and "x unbound". Quite irritating.
Well, it actually consumes text until it hits a blank line.
> Should this become yet another config option for the code, or should we
> simply resort to the more "standard" behavior and error out via srfi-26
> compatible code?
This could even be a run-time configuration option.
Does anyone have a preference?
--- David A. Wheeler
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Readable-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/readable-discuss