Hi Daniel,

you wrote:
>Also, I thought that when you create a word within the body of a function
without
>declaring it as local, it would still be local, and not a global one,
>as it really is.

You're right. A word declared in the body of a function is indeed global,
unless it is declared /local or declared local to a use context. 

If this was not so, we would need a /global flag instead of a /local flag
for function declarations.

In contrast, a word created in the body of an object using the set-word!
notation (a: "some value") is local to the object's context. To create
global words from within an object context use set (set 'a "some value").

o: make object! [
  a: "this word is local to the object referenced by o."
  set 'b "this word is global."
]

Hope this helps,


;- Elan [ : - ) ]
    author of REBOL: THE OFFICIAL GUIDE
    REBOL Press: The Official Source for REBOL Books
    http://www.REBOLpress.com
    visit me at http://www.TechScribe.com


Reply via email to