[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] valid implementation of call-with-input-file?



On Thu 23 Aug 2012 09:28, Alex Shinn <alexshinn@x> writes:

>> It doesn't matter though, the answer
>> here is still no: R6RS programs use different libraries.  c-w-i-f in
>> R6RS does not have the be the same one as in R7RS.
>
> It's not that simple.  Dynamic extent can have complex
> interactions where third-party libraries may "sandwich"
> your own code.
>
> Consider the following parser combinator example:
>
> (let ((parser (parser-or parser1 parser2)))
>   (with-parsers
>    (call-with-input-file file
>      (lambda (in)
>        (let ((stream (make-parser-stream in)))
>          (parser in))))))
>
> If call-with-input-file closes the port on exceptions,
> this code breaks.

There is no portable "exception" interface in the Schemes that R7RS
targets, beyond bare call/cc and a mutable cell.

I must admit I am skeptical of an endeavor that aims to add a new
exception system to Scheme, one that is not present natively in the
majority of implementations, while also aiming to keep compatibility
with non-portable code.

Not to mention the crazy interactions of `raise' and dynamic-wind... but
that is another rant I shouldn't get into.  Good luck with R7RS
exceptions!

Regards,

Andy
-- 
http://wingolog.org/

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports