GNU bug report logs -
#16520
24.3.50; cl-defstruct with :predicate option
Previous Next
Reported by: Helmut Eller <eller.helmut <at> gmail.com>
Date: Wed, 22 Jan 2014 10:08:01 UTC
Severity: normal
Found in version 24.3.50
Fixed in version 24.4
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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.
Helmut
This bug report was last modified 11 years and 167 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.