I updated drakma to 0.6.0 but found the cookie could not be parsed correctly in SBCL. So I traced down into the source code and found it's the problem of function split-string. But in Lispworks Personal, it works well. As the function split-string is a big extended loop macro. So I think it might be a bug in SBCL's loop facility. I also tested in Allegro CL and found it behaves the same as SBCL. So which is correct?
Here's the function split-string in 0.6.0
(10defun split-string (11string &optional (separators " ,-")) "Splits STRING into substrings separated by the characters in the sequence SEPARATORS. Empty substrings aren't collected." (12loop for 13char across 14string 15when (16find 17char separators :test #'18char=) 19when collector collect (20coerce collector '21string) into result 22and 23do (24setq collector 25nil) end else collect 26char into collector finally (27return (28if collector (29append result (30list (31coerce collector '32string))) result))))
Here's the REPL history in Lispworks:
CL-USER 2 > (33setf x "Tue, 06-Mar-2007 00:00:00 GMT") "Tue, 06-Mar-2007 00:00:00 GMT"
CL-USER 4 > (split-string x) ("Tue" "06" "Mar" "2007" "00:00:00" "GMT")
Here's in SBCL:
CL-USER> (34setf x "Tue, 06-Mar-2007 00:00:00 GMT") "Tue, 06-Mar-2007 00:00:00 GMT"
CL-USER> (split-string x)
("Tue" "Tue06" "Tue06Mar" "Tue06Mar2007" "Tue06Mar200700:00:00" "Tue06Mar200700:00:00GMT")
On Mon, 5 Mar 2007 17:13:09 +0900, "Jianshi Huang" jianshi.huang@gmail.com wrote:
I updated drakma to 0.6.0 but found the cookie could not be parsed correctly in SBCL. So I traced down into the source code and found it's the problem of function split-string. But in Lispworks Personal, it works well. As the function split-string is a big extended loop macro. So I think it might be a bug in SBCL's loop facility. I also tested in Allegro CL and found it behaves the same as SBCL. So which is correct?
I don't know. Obviously, AllegroCL and SBCL both simply ignore the (SETQ COLLECTOR NIL) form. I took a brief look at the CLHS description of LOOP but couldn't find anything specific which supported either LispWorks or SBCL/AllegroCL except for the sentence "The VAR argument is bound as if by the construct WITH" which for me sounds as if LispWorks is right.
Any language lawyers on this mailing list?
Would you like to ask on the SBCL mailing list?
Here's the function split-string in 0.6.0
(10defun split-string (11string &optional (separators " ,-")) "Splits STRING into substrings separated by the characters in the sequence SEPARATORS. Empty substrings aren't collected." (12loop for 13char across 14string
How did you manage to add those numbers there?
Cheers, Edi.
On Mon, 5 Mar 2007 17:13:09 +0900, "Jianshi Huang" jianshi.huang@gmail.com wrote:
I updated drakma to 0.6.0 but found the cookie could not be parsed correctly in SBCL. So I traced down into the source code and found it's the problem of function split-string. But in Lispworks Personal, it works well. As the function split-string is a big extended loop macro. So I think it might be a bug in SBCL's loop facility. I also tested in Allegro CL and found it behaves the same as SBCL. So which is correct?
OK, with the help of comp.lang.lisp[1] I've convinced myself that SPLIT-STRING relied on unspecified (or too vaguely specified) behaviour. I've now released a new version which hopefully only uses documented LOOP features. Please test.
Thanks for the report, Edi.
[1] http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/e4bf7cc93bb3...
Edi,
You might want to change the change year on your website for Drakma to 2007 (it says 2006).
--Jeff
On Thu, 8 Mar 2007 18:48:41 -0800, Jeffrey Cunningham jeffrey@cunningham.net wrote:
You might want to change the change year on your website for Drakma to 2007 (it says 2006).
Ah, yes, thanks. I've made a new release to clean up this mess - no code changes, though.