# The introduction for Context in Wagner's book is out of date? [duplicate]

In Section 8.1.1 (P230 of the book, P249 of the PDF) of Wagner's book, the following example is shown:

x = 5;
tempx = 6;
Begin["temp"];
{x, Globalx}


The output is claimed to be:

{6, 5}


But actually in version 8 and 9, the real behavior is:

Have I missed something, or this example is just outdated?

If so, do there exist other outdated parts in this book? Should we start a collection or something?

-

## marked as duplicate by Szabolcs, m_goldberg, bobthechemist, The Toad♦Mar 8 '14 at 19:32

may be you found a bug in the book or a bug in Mathematica :) –  Nasser Mar 8 '14 at 9:06
Try this for more strange result: x = 5; Begin["temp"]; x = 6; {x, Globalx} which gives {6,6} ? –  Nasser Mar 8 '14 at 9:17
@Nasser - If you use BeginPackage to put temp  on the context path it works, but this demo also needs a line break: x = 5; BeginPackage["temp"]; (*line break*) x = 6; {x, Globalx} –  Chris Degnen Mar 8 '14 at 12:21
The very same question was asked a couple of days ago. At that time I noted that even the current v9 documentation is incorrect because it states that when looking for a symbol that was entered, Mathematica searches $ContextPath after searching $Context, even though in reality it searches $ContextPath before $Context –  Szabolcs Mar 8 '14 at 13:48
I wrote another answer there: mathematica.stackexchange.com/a/43629/12 –  Szabolcs Mar 8 '14 at 14:03

This is because of $ContextPath. If the symbol outside the Begin/End is created in a context that is listed in $ContextPath, Mathematica will recognize it as belonging to that context even when called from a different context (even if Begin/End is put in a package file and called via Get):

$ContextPath  {"DocumentationSearch", "ResourceLocator", "PacletManager", "QuantityUnits", "WebServices", "System", "Global"}  WebServicesx; Begin["temp"]; Print@Context@x; End[];   WebServices  Now if I remove "WebServices" from $ContextPath:

$ContextPath = DeleteCases[$ContextPath, "WebServices"];
WebServicesx;
Begin["temp"];
Print@Context@x;
End[];

temp
`

Now what has changed in related code in successive versions, I have no idea.

-

Not an answer. Just screen shot. I booted up version 2.2 to verify the book result. And it does verify.

Something changed since the book was written !

-