[r6rs-discuss] [Formal] I/O: `call-with-port' and multiple returns

Ludovic Courtès ludovic.courtes at laas.fr
Thu Feb 22 09:44:58 EST 2007


---
This message is a formal comment which was submitted to formal-comment at r6rs.org, following the requirements described at: http://www.r6rs.org/process.html
---
Submitter:      Ludovic Courtès
Email:          ludovic.courtes at laas.fr
Type of Issue:  Defect
Priority:       Major
Component:      I/O
Report:         Revised^5.92 Report on the Algorithmic Language Scheme,
                Standard Libraries
Summary:        `call-with-port' and multiple returns


Section 7.2.6 of the manual does not explicitly mention how
`call-with-port' should behave if PROC returns multiple times.  For
instance, is the following a valid implementation of `call-with-port'?

  (define (call-with-port port proc)
    (dynamic-wind
        (lambda ()
          #t)
        (lambda ()
          (proc port))
        (lambda ()
          (close-port port))))

If it is, I would suggest adding a few words saying that once the
dynamic extent of PROC has been left, PORT is closed even if it is
eventually re-entered.

Thanks,
Ludovic.




More information about the r6rs-discuss mailing list