From: JB at CofC on 10 Oct 2009 14:09 On Oct 10, 12:32 pm, Vassil Nikolov <vniko...(a)pobox.com> wrote: > On Sat, 10 Oct 2009 09:23:03 -0700 (PDT), JB at CofC <boet...(a)gmail.com> said: > > > ... > > (let ((x 40)) (defstruct foo (a (+ x 2)))) > > ... > > 4. (let ((x 20)) > > (defstruct (bar (:include foo (a :init-form (+ x 10)))) (b 1))) > > ... > > ...Now, here's another twist. What do you get when you try... > > Obviously (bar-a (make-bar)) yields 30 > > But what happens if... > > (foo-a (make-bar)) ;; is it 30 or 42? > > Different initform in BAR, but still the same slot (and having two > slots with the same name is not allowed anyway), so, 30 for both. > > ---Vassil. > > -- > "Even when the muse is posting on Usenet, Alexander Sergeevich?" Good point. However, what if... (let ((x 40)) (defstruct foo (a (+ x 2))) (make-foo) => #S(FOO :A 42) (foo-a ) => 42 If I make (let ((x 50)) (defstruct (zorch (:include foo)) (b 5))) and (make-zorch) =>#S(ZORCH :A 42 :B 5) ;; the binding of X remains (foo-a *) => 42 Now, if we use... (let ((x 20)) (defstruct (bar (:include foo (a :init-form (+ x 10)))) (b 2))) (make-bar) => #S(BAR :A 30 :B 2) ;; feels right (foo-a *) => 30 From your interpretation, if I now add (let ((x 'quux)) (defstruct (quux (:include foo :init-form x) (b 2))) (make-quux) => #S(QUUX :A QUUX :B 2) (foo-a *) => QUUX Jerry That feels right. Thanks for all help!
From: Madhu on 10 Oct 2009 21:04 * Ron Garret <rNOSPAMon-CEF6E6.08040810102009(a)news.albasani.net> : Wrote on Sat, 10 Oct 2009 08:04:09 -0700: | Are you a native English speaker? What do you think the word | "ambiguity" means? In an earlier thread you questioned if I understood the meaning of `subversive when I applied it to what you were doing here, and you suggested I look it up in a dictionary. I would suggest you do the same thing, except I do not believe you are indulging in these discussion of semantics for any worthwhile reason. -- Madhu
From: Ron Garret on 10 Oct 2009 21:23 In article <m363amlp06.fsf(a)moon.robolove.meer.net>, Madhu <enometh(a)meer.net> wrote: > * Ron Garret <rNOSPAMon-CEF6E6.08040810102009(a)news.albasani.net> : > Wrote on Sat, 10 Oct 2009 08:04:09 -0700: > > | Are you a native English speaker? What do you think the word > | "ambiguity" means? > > In an earlier thread you questioned if I understood the meaning of > `subversive Indeed. At this point I am beginning to question if you understand anything at all. rg
From: Vassil Nikolov on 12 Oct 2009 01:49 On Sun, 11 Oct 2009 22:14:59 -0700 (PDT), Scott Burson <fset.slb(a)gmail.com> said: > ... > Unfortunately, none of the three implementations > I just tried (Allegro, LispWorks, and CMUCL) agree with us. CLISP, though: [1]> (let ((x 1)) (defstruct foo (a x))) FOO [2]> (foo-a (make-foo)) 1 [3]> (defstruct (bar (:include foo))) BAR [4]> (bar-a (make-bar)) 1 [5]> (foo-a (make-bar)) 1 [6]> (let ((x 2)) (declare (special x)) (bar-a (make-bar))) 1 [7]> (let ((x 2)) (defstruct (baz (:include foo)))) BAZ [8]> (foo-a (make-baz)) 1 ---Vassil. -- "Even when the muse is posting on Usenet, Alexander Sergeevich?"
From: Madhu on 12 Oct 2009 06:13
* Vassil Nikolov <snzy6nh2mbg.fsf(a)luna.vassil.nikolov.name> : Wrote on Mon, 12 Oct 2009 01:49:55 -0400: | On Sun, 11 Oct 2009 22:14:59 -0700 (PDT), Scott Burson | <fset.slb(a)gmail.com> said: |> ... |> Unfortunately, none of the three implementations |> I just tried (Allegro, LispWorks, and CMUCL) agree with us. | | CLISP, though: This is as usual a non-conforming bug in CLISP, I wouldnt be surprised if SBCL also took a similar implementation. Every description related to the slot-initforms indicates they are FORMS inserted into the description of the structure being defined. Not some funcallable closure. For example ,---- | The structure using :include can specify default values or | slot-options for the included slots different from those the included | structure specifies, by giving the :include option as: | | (:include included-structure-name slot-description*) | | Each slot-description must have a slot-name that is the same as that | of some slot in the included structure. If a slot-description has no | slot-initform, then in the new structure the slot has no initial | value. Otherwise its initial value form is replaced by the | slot-initform in the slot-description. A normally writable slot can be | made read-only. `---- I believe any alleged ambiguity in the spec is amply resolved in the remaining wording. However instead of wringing hands at misplaced newbie-expectations, , I think I should welcome this oppportunity as another personality test to mark and take a census of all the scheme braindamaged denizens of comp.lang.lisp -- Madhu |