[REBOL] words&context was: (Re: Update)
From: cyphre:volny:cz at: 25-May-2001 10:46
Hi Ladislav and all,
Your docs are very interesting. Since I haven't study them detailed yet I
would like show you my problem regarding contexts because it seems you have
better experience in exploration of this field...
I'm still trying to find a solution for adding/setting a new word to context
without using 'make and here are some of my findings:
>> a: make object! [b: 5]
>> probe a/self
make object! [
b: 5
]
>> a/self: make a/self [b: 8 c: 10]
>> a/c
** Script Error: Invalid path value: c
** Near: a/c
>> a/b
== 5
>> a/self/b
== 8
>> a/self/c
== 10
>> probe a/self
make object! [
b: 8
c: 10
]
>> probe a
make object! [
b: 5
]
>>
seems like 'self doesnot work dynamically...bug or feature?
In this example you can see how is crating of new words in specified context
agressive. I hope we will need another method for adding new words. Without
this is not possible to make modular software...
Here is example for better explanation:
ModuleA: make object! [...]
ModuleB: make object! [...]
main-script: make object! [
....blablabla...
]
How can I insert modules A and/or B into main-script(I really don't need
them in global context)??
another example of using creatinon new words in specified context is even
more difficult:
in this example I want to display on screen different faces for example
including some tables...I also need to add new table to screen.
screen: make face [
table1: make face [...]
table2: make face [...]
pane: [table1 table2]
]
view l: layout [
bx: box with [pane: sceeen]
button "add table3" [
screen: make screen [
table3: make face [...]
]
append screen/pane in screen 'table3
show l
]
]
This method doesnot work because of agressive using of 'make when adding
word table3 while is face screen viewed.
Maybe you could ask why I want to use this method?
I want to choose this method because of easier access into tableX faces for
example:
screen/table2/color: blue
to get all names of subfaces I just use
all-table-names: copy screen/pane
etc.
Normally is used method where pane is a block of faces, not words reffering
to faces in specified context, like:
screen: make face [
pane: [make face [...] make face [...]]
]
in this situation I can use just
screen/pane/1 or screen/pane/2 etc.
I this case I also have to know exact position in pane and need to identify
panes somehow to work with them like:
screen: make face [
pane: ['table1 make face [...] 'table2 make face [...]]
]
this is better solution but again the acces to subfaces(tables) is more
complicated than in method of using pane: [block of words]
I you are understood my confused text and have any comments or solution
don't hesitate to write it ;-)
regards
Cyphre