head>
REBOL for COBOL programmers |
The Global Context
Date written: October 3, 2012 This page attempts to explain a REBOL term that might initially cause confusion. The Global ContextA term that you might run across in REBOL documentation is "global context." This can cause one of those situations where you can't get a firm footing on anything to understand what is being explained, because too may unfamiliar terms are flying around. In a COBOL program, usually, the PROCEDURE DIVISION statements can refer to any data name from anywhere in the program. This is just the way it is, so there is no term for that. However, in other programming languages, things are not that way, so terminology has to exist to differentiate when things ARE that way from when things are NOT that way. In a simple REBOL script, any statement can refer to any word in the program. However, it is possible to make words that can NOT be referred to from anywhere. For example: OBJECT-ID: make object! [ DATA-NAME: "test string" ] In the above example, the word DATA-NAME can not be used anywhere in the program. To refer to it, one must refer to OBJECT-ID/DATA-NAME. The word DATA-NAME is not "global," but is "local" to the object OBJECT-ID. So now we need terminology for words that can be referred to from anywhere, and words that can't. Words that can be referenced anywhere are "global," and words that can't are "local." In REBOL, the set of all words that can be referred to from anywhere are referred to as the "global context." You don't hear that term in COBOL because everything is global all the time, so there is no need for a term to explain that. In other words, in COBOL, everything is in the "global context." In COBOL, the global context exists, but there is no term for it because no term is needed, because there is noting BUT the global context. In REBOL that is not the case, so we DO need the term "global context" because there are words that are NOT part of the global context.So when you are reading the REBOL documentation and you come across the term "global context," be comforted to know that it is not some concept that you know nothing about. You know all about it. You just never have had to have a term for it. |