Subject: Re: Hyperspec questions
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 26 Oct 2003 01:50:43 -0600
Newsgroups: comp.lang.lisp
Message-ID: <UqScncQ9ut9O4QaiXTWc-w@speakeasy.net>
Paul F. Dietz <dietz@dls.net> wrote:
+---------------
| Marc Battyani wrote:
| > Maybe I should ask to the CMUCL guys why they did that change...
| 
| I think they were fixing a bug in the :junk-allowed nil case.
+---------------

Sounds right, especially since the CLHS says [emphasis added]:

	The second value is either the index into the string of the
	delimiter that terminated the parse, or the UPPER BOUNDING INDEX
	OF THE SUBSTRING if the parse terminated at the end of the substring
	(AS IS ALWAYS THE CASE IF JUNK-ALLOWED IS FALSE). 

Compare CLISP-2.29 and CMUCL-18e [before the change] on the following:

	clisp> (parse-integer "1   " :junk-allowed nil)
	1 ;
	4
	clisp> 

versus:

	cmucl> (parse-integer "1   " :junk-allowed nil)

	1
	1
	cmucl> 

Given the quoted CLHS except above, one might well say that CLISP
does it "right" in this case...


-Rob

p.s. However, just to be ornery, also note that:

	clisp> (parse-integer "1   2" :junk-allowed t)
	1 ;
	1
	clisp> 

So at least one implementation gets the :JUNK-ALLOWED NIL case right
*without* giving 1,4 for the :JUNK-ALLOWED T case.  Go figure.

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607