CLOS style: default-initargs vs. multiple initforms

lisp

    Next

  • 1. need help with a (I thought is would be easy) mscro
    First off, I'm sorry I've been a bit of a sponge lately, but I'm a little new. Suppose there is a macro (defmacro call (forms) `(progn ,@forms)) There is alto a function (hooks monster method) whose return value is a suitable argument to call. However, the value of hooks is incorrect unless called at runtime (as opposed to macro expansion time). I have tried to implement a macro (call-hooks monster method), which would expand into a call to call with the return value of hooks with the arguments provided. I am really lost on this, and have tried almost everything I could think of over the weekend. Can someone please give me a few tips? Thanks in advance, Krzysztof Drewniak -- X-Real-Email-With-Antispam: krzysdrewniak at gmail dot com pgp key on keyserver.ubuntu.com and maybe some other place too
  • 2. lisp student job offer
    Hello everyone, at the german institute for polymers (darmstadt/germany) a friend of mine is looking for a student to work with him in lisp. He uses lisp for 3d image-analysis, some numerics and it is planned to implement a web-application in lisp, too. If you are interested, drop him a mail: rgloeckner#dki:tu=darmstadt:de [1] Regards Bernd Schmitt [1] (replace (# @) (: .) (= -))
  • 3. Help: Rephrasing an English statement into questions.
    I know this is not completely related to Lisp, but I know there are a lot of smart people here, so I'm gonna give it a try. I need to write a program that will rephrase an English statement into a question as many different ways as possible. Which libraries will be good for creating a simple version of that? Examples will be nice too. Thanks a lot. JT

CLOS style: default-initargs vs. multiple initforms

Postby Marco Baringer » Mon, 25 Oct 2004 18:42:30 GMT

Assuming i have a class foo:

(defclass foo ()
  ((a :initform nil :initform :a)))

I'd like to sub class foo and change the default value of the slot A
to T, afaict there are two ways to do this:

(defclass sub-foo (foo)
  ()
  (:default-initargs :a t))

or

(defclass sub-foo (foo)
  ((a :initform t)))

Other than 1) the extra direct-slot-definition in the second case and
2) the fact that the first only works when foo's A slot has an
initarg, is there any difference between these two? which style do
people prefer? I'm leaning towards the first as it makes very clear
that the slot we're refering to is foo's A and not some new and
different A.

-- 
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
     -Leonard Cohen

Re: CLOS style: default-initargs vs. multiple initforms

Postby Pascal Costanza » Mon, 25 Oct 2004 21:39:50 GMT





The second alternative may break when someone changes slot a's 
allocation in foo to :class.


Pascal

-- 
Tyler: "How's that working out for you?"
Jack: "Great."
Tyler: "Keep it up, then."

Re: CLOS style: default-initargs vs. multiple initforms

Postby Kenneth Tilton » Tue, 26 Oct 2004 03:20:31 GMT

On 2004-10-24 05:42:30 -0400, "Marco Baringer" < XXXX@XXXXX.COM > said:


I was all over the map on this issue until a hard-to-find bug made me 
notice what I think is a decisive factor: any default-initarg, no 
matter how high up the class inheritance list will trump any initform, 
no matter how specific to a subclass.

So there really is no choice in the matter other than consistently to 
author default values for an inherited slot via default-initargs. The 
initform can be used in the class declaring the slot originally for 
convenience. This comes a cropper only if during refactoring one 
somewhow ends up with a new superclass also "originating" the same slot 
and then some newly-inherited intermediate class specifying a 
default-initarg, but I would expect the refactoring to chop the slot 
from what was the original class to originate the slot. If you know 
what I mean. :)

kenny


Similar Threads:

1.why does the mop handle default-initargs as persistent,

rather than treating them like metaobject or
argument-precedence-order? could someone who was party to the
deliberations shed some light on this?

thanks,
...

2.No visual clue on default ttk::button for default style on Linux

Hello all,

I just noticed something weird: when I create a ttk::button with the  
option '-default active' on Linux, its border is shown differently to  
indicate it's the default one with all styles... except the 'default' one.  
With the default style, the button is shown like any other button and  
there's no visual clue at all that it will be invoked by default. Is it on  
purpose? Or is there something I should do to display it differently?

TIA
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"

3.Windows XP style vs. Windows standard style

Hi!

If a pc runs XP, is there a way from VO to figure out if it runs with XP
style or standard Windows style?

Thanks,
Terje


4.Multiple INCLUDE Vs multiple USE

hi !


  this is a very common problem

5.PMD with CLOS-style Method Combination

6. CLOS style q. class allocated slot initialization

7. Style survey: CLOS accessor names

8. PMD with CLOS-style Method Combination



Return to lisp

 

Who is online

Users browsing this forum: No registered users and 57 guest