Likely the current context doesn't change until the end of the current
expression (similar to the play between side-effects and sequence points
in C/C++).
Below, a CompoundExpression[] contains a Begin[]. I think the Begin[]
will not affect anything in that CompoundExpression[]. So Mathematica
creates t in Global` rather than x`, which you see.
I don't know how to draw a line between parsing and execution in
Mathematica. Perhaps it could be done in terms of the documented
evaluation process. There's been some talk on this lately, I think about
Format[]. Anyone care to elaborate?
Vince Virgilio
-----Original Message-----
From: dh [mailto:dh at metrohm.ch]
To: mathgroup at smc.vnet.net
Subject: [mg70985] [mg70956] Context
Hello,
consider:
fun[x_]:=( Begin[x];
Print[t];
End[];
);
according to the manual one would think that the variable t in context x
is printed. However, this is wrong! What is printed is Global`t.
Therefore, the context to which a symbol belongs is determined during
parsing and NOT execution.
Can anybode give more insight and strict rules for this quirck?
Daniel
************************************
This e-mail and any files transmitted with it are proprietary and intended solely
for the use of the individual or entity to whom they are addressed. If you have
received this e-mail in error please notify the sender. Please note that any views
or opinions presented in this e-mail are solely those of the author and do not
necessarily represent those of ITT, Inc. The recipient should check
this e-mail and any attachments for the presence of viruses. ITT accepts
no liability for any damage caused by any virus transmitted by this e-mail.
************************************