Is it a FOOP peculiarity?
Posted: Thu Jun 26, 2014 12:54 pm
Now I ran into a wall trying to use FOOP, or possibly it's really a bug. Namely that it appears arguments get copied in some funny way.... I've isolated my problem to this small example code:
Thus, there are two contexts: One and Two, where in particular the Two "objects" are supposedly tied to One "objects" on "construction". Both of them also hold an auxillary value, and when a Two object is created, its auxillary value is propagated to its One object.
But in the example, the One object passed in to the Two construction (at mark 2 in the code) is not the same as the One object it operates on in its constructor (at mark 1 in the code), and yet only a single One object has been created!
I get the following output:
This is with "newLISP v.10.6.0 32-bit on Linux IPv4/6 UTF-8 libffi"
I really hope someone can enlighten me about what is going on here, because it kind of is a show stopper for me.
Code: Select all
(context 'One)
(define (One:One v) (list (context) v))
(define (put v) (setf (self 1) v))
(context 'Two)
(define (Two:Two one x)
(:put one x) ;---------------------- mark 1
(list (context) one x))
(context MAIN)
(constant 'uno (One 1))
(constant 'duo (Two uno 2)) ;----- mark 2
(println "uno=" uno)
(println "duo=" duo)
But in the example, the One object passed in to the Two construction (at mark 2 in the code) is not the same as the One object it operates on in its constructor (at mark 1 in the code), and yet only a single One object has been created!
I get the following output:
Code: Select all
uno=(One 1)
duo=(Two (One 2) 2)
I really hope someone can enlighten me about what is going on here, because it kind of is a show stopper for me.