ccl icon indicating copy to clipboard operation
ccl copied to clipboard

Non conformity: read-delimited-list reads dotted-lists

Open informatimago opened this issue 3 years ago • 0 comments

read-delimited-list can read dotted-list, but this is not conforming, since the algorithm for read-delimited-list is specified, and there's no provision to read dots.

read-delimited-list looks ahead at each step for the next non-whitespace[2] character and peeks at it as if with peek-char. If it is char, then the character is consumed and the list of objects is returned. If it is a constituent
or escape character, then read is used to read an object, which is added to the end of the list. If it is a macro character, its reader macro function is called; if the function returns a value, that value is added to the list. The
peek-ahead process is then repeated. 

Note: the reader for #( uses ccl::read-list which behaves as the specified cl:read-delimited-list, there's an inversion here!

$ clall -r '(with-input-from-string (s "a b . c)")  (read-delimited-list #\) s))'

Armed Bear Common Lisp         Dot context error.
Clozure Common Lisp            --> (A B . C)
CLISP                          READ from #<CLOSED INPUT STRING-INPUT-STREAM>: token "." not allowed here 
ECL                            Reader error in file #<closed string-input stream from "a b . c)" 0x10175b640>, position 5: A dotted list was found where a proper list was expected.
SBCL                           dot context error    Stream: #<dynamic-extent STRING-INPUT-STREAM (unavailable) from "a b . c)">

informatimago avatar Aug 02 '21 09:08 informatimago