Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Executable code blocks as arguments

From: tim::johnsons-web::com at: 22-Aug-2001 9:56

Hello All: Is it possible to pass a code block to a function member of an object which would perform adhoc operations on object members? Below is an example which I have set up: REBOL [] o: make object![ a: 1 b: 2 c: 3 modify: func[arg[block!]][do arg] ] print mold o o/modify [a: "one" b: "two" c: "three"] print mold o ; now the output below make object! [ a: 1 b: 2 c: 3 modify: func [arg [block!]][do arg] ] make object! [ a: 1 b: 2 c: 3 modify: func [arg [block!]][do arg] ] ; as you can see, 'a, 'b, and 'c remain unmodified. ; The result that I would be looking for would be: make object! [ a: "one" b: "two" c: "three" modify: func [arg [block!]][do arg] ] Can I do this at all? If so, thanks in advance for advice and comments, and feel free to point me to docs on this. regards Tim