Home   Archive   Permalink

adding fields to an object. normal style ?

Hi ,
is this the normal way to add fields to an object?
here two field should be added to jasmin.
print "" print "" print ""
jasmin: make jasmin [extrafield1: none                
                     extrafield2: none]
probe jasmin
;jasmin a bikini tanga girl

posted by:   Mennohexo       24-Jul-2017/7:04:28-7:00

ok. the object already exists !
thats the assumption here.
so my guess too is , that a oject already exists
is taken by itself and then added two variable names.
It works. Have checked it with : probe jasmin
But , is that the normal procedure to add varables
to an existing orbject ?
I think yes.

posted by:   Mennohexo       24-Jul-2017/13:02:39-7:00

That is the only way to create an object with additional variables under R2 and (to date, anyway) Red.
You are not adding variables to an object - you are creating a whole new object. In many cases, that does not matter. It'd only matter if you still had references elsewhere to the original object.
Under R3, you can use APPEND to add new variables, eg:
     jasmin: make object! [field1: 1]
     append jasmin [extrafield1:1]

posted by:   Sunanda       24-Jul-2017/16:46:44-7:00

Thanks ,
good to know.
The object was cloned from another one.
Minutes later you don't know from which one.
Except there are a few lines to point on that.
It's a experience.
Under normal programming i have a flow chart.
a nice day    
a n    d

posted by:   Mennohexo       25-Jul-2017/11:57:48-7:00



Type the reverse of this captcha text: "! r e g e t n i"