IRC channel logs

2018-04-28.log

back to list of logs

***Raimondii is now known as Raimondi
<lispmacs>hi, using GOOPS, can I have the initial value of one slot be calculated from the initial value of another slot in the same class?
<lispmacs>hi, using GOOPS, can I have the initial value of one slot be calculated from the initial value of another slot in the same class?
<daviid>lispmacs: if not i the class definition, yu can definitely add an initialize method
<lispmacs>daviid: can you clarify?
<daviid>lispmacs: in the manual, look for (define-method (initialize (object <object>) initargs) ...) [and 'play' with it till you're happy ... you'll need to call (next-method) inside your specialized intilize methods ...
<daviid>lispmacs: I'm a bit curious about why you wan't/need to do this though, saying this so you think twice about design ...
<lispmacs>daviid: so, i have game object that needs to store a "health" value and then a "maximum" health value
<lispmacs>currently, I set both values at instance creation
<daviid>these seems independent to me, are they not?
<lispmacs>daviid: during the game they are
<daviid>which one depends on the other?
<lispmacs>at instance creation, I just want to be able to specify maximum-health, and then health is set to that
<lispmacs>of course, it can be damaged, resulting in lowering of health, but not maximum health
<daviid>and then along the game, which one gets altered?
<lispmacs>only health gets altered during the game, maximum health stays the same
<lispmacs>(though of course I might change my mind on that at some point)
<lispmacs>the point is when I create an instance, I only want to have to specify init value for maximum health
<lispmacs>because health will always start off at maximum
<daviid>I see, then you would write an intialize method indeed
<daviid>if the maximum for all gamers?
<daviid>*is
<daviid>or a per instance?
<lispmacs>per instance
<daviid>ok
<daviid>here is an example of such initialize method:
<daviid> http://git.savannah.nongnu.org/cgit/grip.git/tree/grip/clutter/apple.scm?h=devel line 232 and ...
***fibratio` is now known as fibration
***chrislck is now known as chris-T
<lispmacs>Hi, I want to be able to implement a GOOPS class with dependent slots, i.e., one slot initializing to a value based on what another one is set at
<lispmacs>do, I'm trying to figure out how to write `initialize`, but to be honest having a little trouble digesting the info manual on GOOPS MOP.
<lispmacs>is there perhaps a tutorial or something that might be helpful?