On Wed, Dec 09, 2009 at 09:15:01AM +0100, Henrik Sarvell wrote:
> Don't forget, in some cases it's simply enough with ::, for instance
> (pop (:: classVar)). Just to make the discussion complete :-)

Yes, completely correct.

This is the reason why this 'var' mechanism is called that way (and not,
say, 'const').


There is no separate 'set'ter function needed, as the 'any' argument in

   (var sym . any)

can always be selected appropriately to hold any desired value.


Let's say you want to hold three coordinates in a class variable,
you could do

   : (class +Cls)
   ...
   : (var pos 0 0 0)
   -> (0 0 0)

   : (setq X (new '(+Cls)))

   : (with X
      (set (var: pos) 1)
      (set (cdr (var: pos)) 2)
      (set (cddr (var: pos)) 3) )
   -> 3

   : (with X (var: pos))
   -> (1 2 3)

   : (get '+Cls 'pos)
   -> (1 2 3)

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to