Ahoj,

Your problem lies here:

>> type? last main
== word!

instead of:

main: copy []
foreach [n v] second block [
       insert tail main compose [(to-set-word rejoin [first block
"/" :n]) (v)]
]
insert tail main to-word join first block "/f"

you should have written:

main: copy []
foreach [n v] second block [
       insert tail main compose [(to-set-word rejoin [first block
"/" :n]) (v)]
]
insert tail main head insert tail to path! first block 'f

Regards
    Ladislav

----- Původní zpráva -----
Od: <[EMAIL PROTECTED]>
Komu: <[EMAIL PROTECTED]>
Odesláno: 27. května 2000 14:17
Předmět: [REBOL] Objects (and|or) context problem


> Zdravim,
>
> please, look at my problem:
>
> I need two functions - first makes derivation of some object and
the second
> makes block that sets values in the new object and than makes a
function found
> in the same object. From the command line the function works but
when called
> in the block, REBO says it does not exists.
>
> Can anybody help me please?
>
> >> parent-object: make object! [ a: 1 b: 2 f: func[][print [a
b]]]
> ;; this is the 'base' object
> >> block: [hu [a: 3 b: 4]]
> == [hu [a: 3 b: 4]]
> ;; block with settings (function 'f' is same for all
derivations)
> ;; in format [name [values] another-name [another-values] ...]
> >> set first block do [make parent-object second block]
> ;; this selects needed values and makes object out of them
> >> probe hu
>
> make object! [
>     a: 3
>     b: 4
>     f: func [][print "sucsess"]
> ]*
> *
> ;; still seems OK
> >> main: copy []
> >> foreach [n v] second block [
>        insert tail main compose [(to-set-word rejoin [first
block "/" :n]) (v)]
>    ]
>    insert tail main to-word join first block "/f"
> >> head main
> == [hu/a: 3 hu/b: 4 hu/f]
> ;; this makes block that changes values in the existing object
> ;; and than evaluates 'f function
> >> hu/f
> 3 4
> ;; BUT, NOW LOOK AT THE PROBLEM!!!!
> >> do main
> ** Script Error: hu/f has no value.
> ** Where: hu/f
>
> If I insert probe hu into the block there IS 'f function in 'hu
object.
>
> Do I have to make new object with the same name everytime I want
just to
> change some values in the object?
>
> Louci se
> --
> --you've been/byl jsi contacted/kontaktovan
> ---------------
> [EMAIL PROTECTED]
> -------------www.volny.cz/weirddream
> ------------------------------------
>
>
>

Reply via email to