defstruct :predicate failure

Andrew Kirkpatrick ubermonk at gmail.com
Wed May 9 04:03:35 UTC 2018


Interestingly I cannot reproduce it. I'm running Linux Mint 18.2 and
built ECL from a git checkout of the tag ECL-16.1.3:

$ /opt/ecl/bin/ecl
;;; Loading "/home/spacebat/quicklisp/setup.lisp"
;;; Loading #P"/opt/ecl/lib/ecl-16.1.3/asdf.fas"
ECL (Embeddable Common-Lisp) 16.1.3
(git:17645d703eb95b9452186015f5f3a1a9c0bc6b6a)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
Copyright (C) 2016 Daniel Kochmanski
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.
Top level in: #<process TOP-LEVEL>.
> (defstruct (foo (:type vector) (:predicate nil)) qux bar)
FOO

> (make-foo :qux "q" :bar "b")
#("q" "b")


However if I install ECL via apt, I get an older version with this banner:

ECL (Embeddable Common-Lisp) 15.3.7 (git:UNKNOWN)

The error you describe is then evident.


On 8 May 2018 at 17:13, Peter Keller <psilord at cs.wisc.edu> wrote:
> Hello,
>
> I ran into a situation where I think ECL 16.1.3 has a bug in it:
>
> Linux violet > ecl
> ;;; Loading "/home/psilord/quicklisp/setup.lisp"
> ;;; Loading #P"/usr/local/lib/ecl-16.1.3/asdf.fas"
> ECL (Embeddable Common-Lisp) 16.1.3 (git:UNKNOWN)
> Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
> Copyright (C) 1993 Giuseppe Attardi
> Copyright (C) 2000 Juan J. Garcia-Ripoll
> Copyright (C) 2016 Daniel Kochmanski
> ECL is free software, and you are welcome to redistribute it
> under certain conditions; see file 'Copyright' for details.
> Type :h for Help.
> Top level in: #<process TOP-LEVEL>.
>> (defstruct (foo (:type vector) (:predicate nil)) qux bar)
>
> Condition of type: SIMPLE-ERROR
> NIL is an illegal structure predicate.
>
> Available restarts:
>
> 1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.
>
> Broken at SI:BYTECODES. [Evaluation of: (SI:TOP-LEVEL T)] In: #<process TOP-LEVEL>.
>>>
>
>
> The clhs spec says:
>
> http://www.lispworks.com/documentation/lw70/CLHS/Body/m_defstr.htm
>
> most notably:
>
>
> ":predicate
>
>     This option takes one argument, which specifies the name of the type
> predicate. If the argument is not supplied or if the option itself is not
> supplied, the name of the predicate is made by concatenating the name of the
> structure to the string "-P", interning the name in whatever package is current
> at the time defstruct is expanded. If the argument is provided and is nil, no
> predicate is defined. A predicate can be defined only if the structure is
> named; if :type is supplied and :named is not supplied, then :predicate must
> either be unsupplied or have the value nil. "
>
>
> In this case, :type is supplied, :named is not supplied, and therefore
> :predicate must either be unsupplied or have the value NIL. In my case, it
> has the value NIL.
>
> It appears to me that I have written legal CL, but ECL doesn't think so.
>
>
> Thank you!
>
> -pete
>



More information about the ecl-devel mailing list