Skip to content

Instantly share code, notes, and snippets.

@epanji
Created August 19, 2020 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epanji/48507968d74a3355e59ef9c544fda93e to your computer and use it in GitHub Desktop.
Save epanji/48507968d74a3355e59ef9c544fda93e to your computer and use it in GitHub Desktop.
(in-package :cl-user)
(defstruct foo a)
(defun expected-type (fun)
(handler-case (funcall (typecase fun
(function fun)
(symbol (symbol-function fun))
(t nil))
nil)
(type-error (c) (type-error-expected-type c))))
(format t "~&;; ~A ~A => Type: ~A~%"
(lisp-implementation-type)
(lisp-implementation-version)
(expected-type 'foo-a))
;; Results came from C-u C-x C-e
;; (slime-eval-last-expression)
;; SBCL 2.0.7 => Type: FOO
;; ECL 20.4.24 => Type: FOO
;; Armed Bear Common Lisp 1.7.1 => Type: STRUCTURE-OBJECT
;; Question:
;; Is it a bug for ABCL or implementation-dependent for TYPE-ERROR-EXPECTED-TYPE?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment