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

[REBOL] Re: "get" function

From: edoconnor:g:mail at: 9-Nov-2010 11:54

> So, in a nutshell, `:blah' is identical to `get blah'? > -- > Duke > --
As far as I know, yes, although the get notation is probably quicker. if is the standard or natural form; it refers to the action of returning any referenced value if: is the "set form"; it refers to the action of assigning if to a value 'if is the literal form; it refers to the word/symbol, isolated from any value it references :if is the "get form"; it refers to the referenced value, isolated from any word handles on the value If you evaluate native? if, you'll run into a problem because you used the natural form of if, which means it will trigger the dereferencing process (which requires arguments to be supplied to the function). You can inspect the function value referenced by if just like a series. To do this, use the get-form (or the get function) and use a series function:
>> first :if
== [condition then-block /else else-block]
>> second :if
== none
>> third :if
== [ "If condition is TRUE, evaluates the block." condition then-block [block!] /else "If not true, evaluate this block" else-block [block!] ] if is a native in R2, so there isn't much to access here. A function like probe might be better, since it's a mezzanine. Here are some of the guts of the simple probe function.
>> second :probe
== [ print mold :value :value ]
>> first second :probe
== print
>> second second :probe
== mold