Context and Rebol call
[1/6] from: lp:legoff:free at: 14-Oct-2004 9:47
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 context,
but the other ?
2/ What's happen (what steps ?) when Rebol.exe is launched ? (upload in memory,
use of the user.r?) Is somebody could explain me that ?
TIA,
==Philippe
[2/6] from: AJMartin::orcon::net::nz at: 14-Oct-2004 13:43
Hi, Philippe.
You wrote:
> 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
> context, but the other ?
This situation is the same as:
>> My-Integer: 2
and
>> 2
In all cases, Rebol evaluates each value and, as part of it's evaluation,
evaluates any necessary values to the right. When Rebol evaluates the value
to the right of the set-word (in the first example) or the first value, the
value is returned to form the value needed for the previous value's
evaluation. So the context (or 2, in my second example) is evaluated,
producing a Rebol value. That value is then used as input for the previous
value to the left. If there's no set-word! value, then nothing much further
happens. The set-word! assigns the value of the expression to the right to
the word contained in the set-word!.
I hope that helps!
---
Andrew Martin
ICQ: 26227169
http://www.rebol.it/Valley/
http://valley.orcon.net.nz/
http://valley.150m.com/
[3/6] 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 :
<<quoted lines omitted: 8>>
>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.
[4/6] from: antonr::lexicon::net at: 15-Oct-2004 0:52
Hi Philippe,
1/ CONTEXT - check the source of 'context.
You will see that it just makes an object!
Therefore, the difference your two examples is
that the first object has a word referencing it,
and the second object does not.
The second context is often called an "anonymous
context".
2/ I am not sure exactly what information you want,
perhaps the order of operations. Well, looking at
Sys Internals File Monitor log output (carefully filtered)
It looks like, after rebol.exe starts, it loads, in order:
- a whole bunch of windows DLL's
then the following files:
- license.key
- rebol.r
- user.r
What strikes me as strange, is, *before* the DLL's are loaded,
lots of directories in the public cache (only the ones that
I reference by doing my user.r) are scanned.
Perhaps this is rebol's LOAD phase, which verifies all the
file paths ??! then later the files are actually done.
I'm at a loss to how to explain this at the moment. :)
Anton.
[5/6] from: Izkata::Comcast::net at: 14-Oct-2004 17:23
> It looks like, after rebol.exe starts, it loads, in order:
> - a whole bunch of windows DLL's
<<quoted lines omitted: 8>>
> file paths ??! then later the files are actually done.
> I'm at a loss to how to explain this at the moment. :)
Yeah, it seems that it loads the %user.r file before
-anything- else... It even loads it before it prints the
{REBOL/View 1.2.46.3.1 6-Apr-2004 Core 2.6.0} line...
[6/6] from: lp::legoff::free::fr at: 15-Oct-2004 16:14
Hi!
Thank's for all your responses.
I found some complementary informations :
In your user.r, write :
echo %/load-rebol.txt
trace on
to see the log.
See also:
http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlQKJS
==Philippe
Selon Izkata <[Izkata--Comcast--net]>:
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted