From: hemmecke on
Hello,

I'd like to understand the behaviour of the following program foo.m.
It seems to have different semantics in Mathematica 5.2 vs. Mathematica 6/7.

---rhxBEGIN foo.m
Print["Context0: ", $Context];
Print["ContextPath0: ", $ContextPath];
BeginPackage["A`"];
Foo::usage = "blah blah";
Begin["`Private`"];
Foo[] := Module[
{method}
,
Print["Context: ", $Context];
Print["ContextPath: ", $ContextPath];
Print["0: ", Options[RowReduce]];
method = Options[RowReduce, Method];
Print["1: ", method];
SetOptions[RowReduce, Method -> OneStepRowReduction];
Print["2: ", Options[RowReduce]];
];
End[];
EndPackage[];
---rhxEND foo.m

When I execute that in Mathematica 5.2, I get

================================
Mathematica 5.2 for Linux
Copyright 1988-2005 Wolfram Research, Inc.
-- Motif graphics initialized --

In[1]:= <<foo.m
Context0: Global`
ContextPath0: {Global`, System`}

In[2]:= Foo[]
Context: Global`
ContextPath: {A`, Global`, System`}
0: {Method -> Automatic, Modulus -> 0, Tolerance -> Automatic,

> ZeroTest -> Automatic}
1: {Method -> Automatic}
2: {Method -> OneStepRowReduction, Modulus -> 0, Tolerance ->
Automatic,

> ZeroTest -> Automatic}
================================================

However, in Mathematica 6 and 7 t's like this:

================================================
Mathematica 6.0 for Linux x86 (32-bit)
Copyright 1988-2007 Wolfram Research, Inc.

In[1]:= <<foo.m
Context0: Global`
ContextPath0: {WebServices`, System`, Global`}

In[2]:= Foo[]
Context: Global`
ContextPath: {A`, WebServices`, System`, Global`}
0: {Method -> Automatic, Modulus -> 0, Tolerance -> Automatic,

> ZeroTest -> Automatic}
1: {Method -> Automatic}
2: {Method -> A`Private`OneStepRowReduction, Modulus -> 0,

> Tolerance -> Automatic, ZeroTest -> Automatic}
================================================

The difference is in the line starting with "2:".
Only when I replace OneStepTopReduction in foo.m by
System`OneStepTopReduction then the output in Mathematica 6 and 7 will be
identical to what Mathematica 5.2 says. Why?

OneStepTopReduction lives in the System` context (I guess). So, since
the $ContexPath includes System`, Mathematica should find that symbol there
and not create it in A`Private`. What's wrong here?

Ralf