[ sisc-Bugs-1653382 ] read-string behaviour does not match documentation

"SourceForge.net" <[email protected]> Tue, 06 Feb 2007 07:42:56 -0800
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>
Bugs item #1653382, was opened at 2007-02-06 15:42
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379534&aid=1653382&group_id=23735

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Norman Gray (normang)
Assigned to: Nobody/Anonymous (nobody)
Summary: read-string behaviour does not match documentation

Initial Comment:
The documentation for READ-STRING says:

procedure: (read-string buffer offset count [character-input-port]) => integer

Reads up to count characters from the implicit or specified character port into the string buffer starting from the position specified by the integer offset. The number of characters successfully read (which may be fewer than count) is returned, or the end-of-file value if the end-of-file was reached before any characters were encountered.



However READ-STRING actually returns -1 on EOF, not eof-object:


% sisc
SISC (1.16.0-alpha)
#;> (import string-io)
#;>  (call-with-input-string "foo"
 (lambda (p)
   (let ((b (make-string 10)))
     (format #t "first:  ~s~%" (read-string b 0 10 p))
     (format #t "second: ~s~%" (read-string b 0 10 p)))))
first:  3
second: -1
#;> ^D
%

(the same is true when reading from a file).  Presumably it's the
documentation that's in error, though I can see the attraction
of having READ-STRING always return an in-range integer if it returns
one at all.

Does READ-STRING make a forward-progress guarantee, or can it return 0?

If this is indeed the only problem, I can edit the docs.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379534&aid=1653382&group_id=23735

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642