Fun with (language) objects

Keisuke Miyako (5/20/14 1:50AM)

Keisuke Miyako (5/20/14 1:50 AM)

there are 3 ways to deal with this problem.

as a reminder,
the question here is how one can append objects to an array of objects.

the conventional style


will not work, since the assignment (:=) operator does not create a
of the right operand
(which as I will explain below, is the ?=A2?=82=C5ìreal?=A2?=82
=C2ù problem)

solution 1, as Chris described is to have a separate object (array of
objects) for each element.

ARRAY OBJECT($objs;10)
OB SET($objs{n};?=A2?=82=C2

solution 2, is to CLEAR VARIABLE for each iteration.


the command will not erase the previous content of $obj,
as it is still referenced by the array to which it was appended.

it will only clear the content of the local variable and let it start a
new life.

solution 3, is to use OB Copy instead of :=

APPEND TO ARRAY(OB Copy($obj);?=A2?=82=C2

as I mentioned earlier, the assignment operator used against an object
does not create a clone,
it merely passes the reference to the same object.

there is a dedicated command to create a copy of an existing object, OB
in the code example above, $obj is never attached to the array,
it is always a close of the object that is appended.


On 2014/05/19 22:28, "Chris Curnow" <chris@... wrote:

color><param>00000,0000,DDEE/param>TThe only way I could find to do it
was to create an array of objects and
set $object to a new (previously unused) element of the array each time
through the loop.

Reply to this message

Summary created 5/20/14 at 6:54AM by Intellex Corporation

Comments welcome at: