proposal: view/when-up, and gc-bug
[1/1] from: agem::crosswinds::net at: 18-Jun-2001 16:01
proposal: view/when-up, and gc-bug
Hi Rebols
sometimes there are needs to do some stuff after view is ready,
but before it goes to do-events.
usually done with
view/new something
patch something
do-events
and not full compatible with the rule:
new view replaces old view without /new.
i patched it with [/when-up block] which is executed
just before show.
this way one can have specially own feels, which are overwritten
by /view.
would like it inbuild. (called it view1 till then).
first version:
view1: func load mold head insert find copy/deep third :view [/local] [
/when-up block]
head insert find copy/deep second :view [show] [
if when-up [do block]]
;test
view1/when-up layout[title "hello world" f: field]
[f/text: mold request/confirm "up" show f]
GC-BUG:
then, if i replace a function which is running,
/view often crashes.
that means, if a script does itself, 'view1 replaced, crash later.
i found that refercencing the function by its body helps.
so i created a second version,
which includes 'self in the body, and it runs currently stable.
context [
view1: func load mold head insert find copy/deep third :view [/local] [
/when-up block]
head insert find copy/deep second :view [show] [
SELF if when-up [do block]]
;source view1
system/words/view1: :view1
]