Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: contexts: nailing jelly to a tree?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg6232] Re: [mg6208] contexts: nailing jelly to a tree?
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Fri, 28 Feb 1997 03:21:59 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

murray at math.umass.edu (Murray Eisenberg)
[mg6208] contexts: nailing jelly to a tree?
gives the examples

(* New session #1: *)

BeginPackage["test`"]
Begin["Private`"]
   y1 = 99;
   Print[Context[y1]]
End[]
EndPackage[]

(* output *)

test`

Private`

Private`      (* that's what I expect *)

Private`

(*******************************)

(* New session #2: *)

(* input *)

BeginPackage["test`"];
Begin["Private`"];
   y1 = 99;
   Print[Context[y1]];
End[];
EndPackage[];

(* output *)

Global`    (* this is the surprise *)

(**********************)

Murray:
In #2 The semicolons cause the cell contents to be interpreted as a  
single compound expression; all the symbols in this expression are  
created before any evaluation; hence all are created in the context  
"Global`".
The context "test`" will be added to the context path as before  
when the cell is evaluated - you can check this, and the context, by  
evaluating  {$Context, $ContextPath}

Allan Hayes
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk







--
  Murray Eisenberg                       Internet:  murray at math.umass.edu
  Mathematics & Statistics Dept.            Voice:  413-545-2859 (W)
  University of Massachusetts                       413-549-1020 (H)
  Amherst, MA 01003                           Fax:  413-545-1801



  • Prev by Date: Re: contexts,packages,names: again!
  • Next by Date: Windows front end
  • Previous by thread: Re: Multiple convert to EPSF
  • Next by thread: Windows front end