[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16520: 24.3.50; cl-defstruct with :predicate option

From: Helmut Eller
Subject: bug#16520: 24.3.50; cl-defstruct with :predicate option
Date: Wed, 29 Jan 2014 18:47:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

On Wed, Jan 29 2014, Stefan Monnier wrote:

>> The fix doesn't work for this example:
>>  (require 'cl-lib)
>>  (cl-defstruct (foo (:predicate foo?)))
>>  (defun bar (x) (cl-check-type x foo))
> Indeed.  But it should work for:
>    (require 'cl-lib)
>    (cl-defstruct (foo (:predicate foo?)))
>    (defun bar (x) (cl-check-type x foo?))

Which is arguably a bug.  If the goal is to imitate Common Lisp
semantics then the type name is foo not foo?.  If I wanted to call a
predicate I would have written (check-type x (satisfies foo?)).

>> neither for
>>   (cl-defstruct (foo (:predicate nil)))
> Not sure if it should work in that case,

It does work in Common Lisp.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]