[REBOL] objects without overhead Re:(2)
From: rishi:picostar at: 18-Oct-2000 2:04
There were a few mistakes in my previous emails code. I tried out the basic concept though...but
it was a failure. here's a simplified version of code. This is real code and I have run
it through rebol:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CODE BEGINS HERE
state: make object! [
new: func [
puzzle [block!]
][
return make object! [
puz: copy reduce puzzle
get-puzzle: :get_puzz
]
]
get_puzz: does [return copy puz]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;: TEST CODE
; comment {
test-obj: new [1 2 3 4 0 5 6 7 8]
print test-obj/get-puzzle
; }
]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CODE ENDS HERE
Now if you copy this code and run it, you get the following error:
** Script Error: puz has no value.
** Where: return copy puz
>>
I was really hoping this would work. It seemed like an elegant solution. I don't understand
why get-puzzle cannot access word 'puz.
Previously, you ([rishi--picostar--com]) wrote: