Ciao Luca,
It is possibile to express
Myarray/2/myfunc
in a way that is easy to use the first value of the array as index ?
myarray/position1/myfunc does not work
Another question: how do I append another line in that block to have
["position3" another_object] without having to explicit give a name to
"another_object"
I am still confused from C language with the concept of pointers. Excuse =
me
but I need some more time to exit from "THE MATRIX" of classic =
programming.
Please follow my way of thinking:
- to have another object I must create it from a prototype
myobj-proto: [
a: 1
b: 2
myfunc: does [print "value of a" SELF/a]
]
Myobj: make object! Myobj-proto
- then I must create an array giving it as array object in the form
Myarray: reduce [
"position1" myobj
]
I have just discovered that
Myarray: reduce [
"position1" :myobj
]
Is the same of the previous statement
Ok, now I need to create another object and append it to the array.
myobj: context Myobj-proto [a:NEW_VALUE1 b:NEW_VALUE2]
... APPEND .... (I still do not know how to append) where the block is
["position3" :myobj]
Is it correct to make another object assigning it again to myobj ? =
(Reusing
"myobj" as a temporary name) ? Or doing this will change :myobj of
"position1" in the array?
Giuseppe Chillemi
-----Messaggio originale-----
Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Per conto di =
Luca
Truffarelli
Inviato: luned=EC 7 novembre 2005 14.34
A: [EMAIL PROTECTED]
Oggetto: [REBOL] Re: Oooooops ! Is Array of objects not possible ?
Just correct this way:
Myarray: reduce [
"position1" myobj
"position2" myobj2
]
and then
Myarray/2/myfunc
Luca
> Hello,
> we have gone so far with the object but. how do I create an array of
> object ? It is written nowhere in the manual and it does not seem
possible.
>=20
> myobj-proto: [
> a: 1
> b: 2
> myfunc: does [print "value of a" SELF/a]
> ]
>=20
> Myobj: make object! Myobj-proto
> Myobj2: make object! Myobj-proto [a:10 b:20]
>=20
> I want
>=20
> Myarray: [
> "position1" myobj
> "position2" myobj2
> ]
>=20
> How do I execute position1 -> myobj/myfunc ?
>=20
>=20
> Giuseppe Chillemi
>=20
>=20
> --=20
> To unsubscribe from the list, just send an email to=20
> lists at rebol.com with unsubscribe as the subject.
>=20
>=20
--=20
To unsubscribe from the list, just send an email to=20
lists at rebol.com with unsubscribe as the subject.
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.