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

[REBOL] Re: Context and Rebol call

From: lmecir:mbox:vol:cz at: 14-Oct-2004 16:31

[lp--legoff--free--fr] napsal(a):
>Hello, rebolers ! > >Two questions in my mind today : > >1/ About 'context : what's the difference for Rebol between : > >>>my-context: context [ ....bla bla bla ... ] >>> >>> > and > >>>context [ ....bla bla bla ... ] >>> >>> > >I noted that the first code just set one word ('my-context) in global con >text, >
not exactly, see this: my-context: make object! [ attribute: 14 print ["just creating a new object with attribute" attribute] ] it creates an object and runs some code (prints). Later you can use my-context as a data-container containing just the value of the ATTRIBUTE.
>but the other ? >
the other only creates an object executing the code. The object is collected afterwards. The main purpose for doing it this way is to prevent the Global Context Pollution, because the code will not interfere with any global ATTRIBUTE that might exist.