Why can it deduce from (READ-FROM-STRING “foobar” :START 3) that the intent is to specify the START keyword parameter rather than the EOF-ERROR-P and EOF-VALUE optional parameters?
In Common Lisp, keyword symbols are first-class data objects. Therefore, they are perfectly valid values for optional parameters to functions. There are only four functions in Common Lisp that have both optional and keyword parameters (they are PARSE-NAMESTRING, READ-FROM-STRING, WRITE-LINE, and WRITE-STRING), so it’s probably not worth adding a nonorthogonal kludge to the language just to make these functions slightly less confusing; unfortunately, it’s also not worth an incompatible change to the language to redefine those functions to use only keyword arguments.
Related Questions
- Why can it deduce from (READ-FROM-STRING "foobar" :START 3) that the intent is to specify the START keyword parameter rather than the EOF-ERROR-P and EOF-VALUE optional parameters?
- Can I specify a default value of "SYSDATE" (the current date) for a report parameter?
- How to print the help for one CL command keyword parameter?