GNU bug report logs -
#77725
31.0.50; Add support for types accepted by `cl-typep' to cl-generic?
Previous Next
Full log
Message #242 received at 77725 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> Please find attached a proposal to improve error handling in
> `cl-types-of'. Ultimately, I think you were right and it is better to
> simply report derived type errors to the caller and abort processing,
> but while also preventing their recurrence as much as possible :-)
>
> So my proposal is to still handle any error on a derived type, in
> order to disable the type as is currently done by removing it from the
> list of types; but, instead of warn, raise a new `cl-type-error'
> mentioning the type in error and the underlying error. Here are some
> simple examples for you to observe the result.
>
> (cl-deftype T1 ()
> '(satisfies plusp))
>
> (cl-types-of -0.5)
> => (real float number number-or-marker atom t)
>
> (cl-types-of 12)
> => (T1 real base-char character fixnum natnum integer number integer-or-marker number-or-marker atom t)
>
> (cl-types-of "12")
> => Error on derived type: T1, (wrong-type-argument number-or-marker-p "12")
>
> (cl-deftype T2 ()
> `(satisfies ,(lambda (o) (memq 'T1 (cl-types-of o)))))
>
> (cl-types-of "12")
> => Error on derived type: T2, (excessive-lisp-nesting 1601)
>
> Does it make sense?
Please find attached a better patch, and a possible change log below.
Thanks
David
2025-05-19 David Ponce <da_vid <at> orange.fr>
Signal a `cl-type-error' instead of warning when a derived type
encounters an error.
* lisp/emacs-lisp/cl-extra.el (cl-type-error): New error symbol.
(cl-types-of): Use it.
[cl-extra-V1.patch (text/x-patch, attachment)]
This bug report was last modified 10 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.