Thought I'd have a crack at doing something similar in Rebol. Here's my attempt:
Rebol []
; Here's the beef!... the spreadsheet object
spreadsheet: context [
update: func [block /local b] [
b: compose/deep block
bind b self ; so action happens in object context
do b
]
]
; make sheet with following cells
ss: make spreadsheet [
a1: 5
a2: does [a1 * 6]
a3: does [a2 * 7]
]
; simple usage example
print ss/a3 ; => 210
ss/a1: 6
print ss/a3 ; => 252
; use /update method to keep it within the objects context (needed for DOES)
ss/update [a3: does [a1 + a2]]
print ss/a3 ; => 42
; and compose in variables from current context, see (a1)
a1: 1000
ss/update [a3: does [a1 + (a1)]]
print ss/a3 ; => 1006
You could probably do something very similar in other prototype based object languages.
Thought I'd have a crack at doing something similar in Rebol. Here's my attempt:
You could probably do something very similar in other prototype based object languages.