Re: defstruct with by-order-of-argument constructor

Raymond Toy <[email protected]>
Newsgroups gmane.lisp.cmucl.general
Message-ID <[email protected]>
>>>>> "Albert" == Albert Reiner <[email protected]> writes:

    Albert> Hi,
    Albert> using the CMU Common Lisp Snapshot 2005-11 (19C) on Linux x86, I get
    Albert> undesirable results for defstructs with b-o-a constructors like the
    Albert> following:

    Albert>   (defstruct (foobar
    Albert>                (:constructor make-foobar
    Albert>                              (xxx
    Albert>                               &key (aaa nil) (bbb nil)
    Albert>                               &aux
    Albert>                               (foobar-data xxx)
    Albert>                               (aaa (or aaa
    Albert>                                        (getf foobar-data :aaa)
    Albert>                                        1))
    Albert>                               (bbb (or bbb
    Albert>                                        (getf foobar-data :bbb)
    Albert>                                        (1+ aaa))))))
    Albert>     (aaa (required-argument) :type fixnum)
    Albert>     (bbb (required-argument) :type fixnum))

    Albert> The intent is to have a b-o-a constructor with keyword arguments with
    Albert> more complicated defaults; in reality, the binding for FOOBAR-DATA is
    Albert> a potentially expensive computation depending on XXX.

    Albert> I believe the above is valid CL (cf. CLHS 3.4.6), and Clisp in fact
    Albert> accepts it and produces the desired results:

Sorry for the long delay.

I think your analysis is correct.  I think we still need at least to
check the type is correct.  I just don't know exactly where that
should be done now, and how to make it actually happen.

I'll poke around some more soon.

Ray
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.