|
Pages: [1]
|
 |
|
Author
|
Topic: objects and functions (Read 485 times)
|
|
fhein
|
a: make object! [ d: "some stuff" f: does [ print d ] ]
b: make a []
will the new object b contain a copy of the function a/f or just a pointer to the original function? I hope I haven't asked this before and just forgot about the answer
|
|
|
|
|
Logged
|
|
|
|
|
CarlRead
|
Going by this test of it done at the console... >> a: make object! [ [ d: "some stuff" [ f: does [ print d ] [ ] >> >> b: make a [] >> x: get in a 'f >> type? :x == function! >> y: get in a 'f >> same? :x :y == true >> z: get in b 'f >> same? :x :z == false it makes a new function.
|
|
|
|
|
Logged
|
- Carl Read
|
|
|
|
fhein
|
So to save some memory, I suppose I would have to a: make object! [ d: "somestuff" ] f: func [obj][ print obj/d ]
But that gets kinda awkward for longer functions with more descriptive names (which I ofcourse use  ). Do you know any ways I could improve my program regarding this matter?
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |