[REBOL] Re: Obscure? You be the judge!
From: nitsch-lists:netcologne at: 14-May-2002 11:52
Hi Joel,
>> a: context [ b: [1]]
>> c: make a[]
>> d: make a[]
>> same? a/b c/b
== false
>> same? c/b d/b
== false
when you 'make an 'object!, all strings, blocks and functions are copied.
that allows for example in 'layout :
box with[append init[my-inits]]
without destroying the original in box.
also blocks, like functions, are rebound.
so [make child-proto []] gives a copy of 'dataref, not the original.
but objects are not copied,
so the 'face/feel are all the same after [make face[]].
or in your case,
do [
ex: func ["probe-tool" block] [print [">>" mold/only block "^/"] do block]
bug?: make object! [
width: 2
data: context [block: [1]] ;;; object!
plop: func [b [block!]] [append data/block b]
child-proto: make object! [
label: "no such"
dataref: data
dump: func [] [print [label newline tab mold dataref]]
reset: func [] [dataref/block: head dataref/block]
]
children: make block! width
repeat i width [
append children make child-proto [
label: join "Child-" i
]
]
fizz: func [] [
foreach child children [
child/dump
]
]
]
ex [bug?/fizz]
ex [bug?/plop [3 5 7]]
ex [bug?/fizz]
]
>> bug?/fizz
Child-1
make object! [
block: [1]
]
Child-2
make object! [
block: [1]
]
>> bug?/plop [3 5 7]
>> bug?/fizz
Child-1
make object! [
block: [1 3 5 7]
]
Child-2
make object! [
block: [1 3 5 7]
]
greetings
-volker
Am Dienstag, 14. Mai 2002 06:17 schrieb Joel Neely: