armedbear / abcl

Armed Bear Common Lisp <git+https://github.com/armedbear/abcl/> <--> <svn+https://abcl.org/svn> Bridge
https://abcl.org#rdfs:seeAlso<https://gitlab.common-lisp.net/abcl/abcl>
Other
288 stars 29 forks source link

errorhandling/ behaviour with erroneus code #668

Open mayerrobert opened 4 months ago

mayerrobert commented 4 months ago

I was fixing/ tinkering with the error handling of my own Lisp and while checking what other Lisps do I noticed some unexpected behaviour in abcl:

CL-USER(1): (typep nil 'xyxxy) ;; sbcl signals simple-error (in the REPL and IMO erroneously does not signal in compiled code) NIL

CL-USER(2): (typep 1 'xyxxy) ;; sbcl signals simple-error NIL

CL-USER(3): (read-from-string "#\Bla") ;; signals error, should probably signal reader-error

CL-USER(4): (read-from-string "(xyxxy . 1 2)") ;; sbcl signals simple-reader-error "More than one object follows . in list." (XYXXY 2) 13

FYI: CL-USER(5): (lisp-implementation-version) "1.9.2" "OpenJDK_64-Bit_Server_VM-Oracle_Corporation-18.0.1+10-24" "amd64-Windows_10-10.0"

I'm not a 100% sure if the Common Lisp spec requires the above to be fixed or if these are cases of "implementations should..." so feel free to ignore/ proceed as you see fit.

alejandrozf commented 3 months ago

The page for cl:typep in CLHS says: The consequences are undefined if the type-specifier is not a type-specifier.
So, for the first 2 examples the implementation is not required to signal a type-error.

alejandrozf commented 3 months ago

For the third one I think the standard requires an error but not specifically a reader-error. But I think it shouldn't be difficult to change it to reader-error for better information to the user.

alejandrozf commented 3 months ago

And the last one would be a bug IMO.