Message Boards Message Boards

0
|
8570 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to see package level variables ?

Posted 10 years ago
Hello Everybody,

I just started to develop a Mma package inside Workbench and I have a question regarding the debugging process.
In my package I have several functions defined and I use variables that are local to the functions (defined inside Module[]) and
variables that reside at the package level. My problem is that when I debug a function I can only see the variables that I have defined
inside the Module[], but not those that exist at the package level. The question is now to to inspect the content of those package
level variables ??

For clarification here some sample code.
When I debug func I can see locVar, but not packVar !

BeginPackage["MyPackage`"]
func[x_]:=
Module[{locVar},
   locVar = x+5;
   packVar = x+2;
]
EndPackage[]

Many thanks,
   Alex
POSTED BY: Al Ex
2 Replies
Posted 10 years ago
Hi Ilian,

That works and is definitely better than nothing.
However, only simple variables (bla=5) are correctly displayed.
More complicated structures, like a list of rules,  are not properly displayed  (they are strangely mangled), while local variables of the same type are correctly displayed in the "Variables" view :-(

Many thanks for the tip,
   Alex
POSTED BY: Al Ex
It is possible to add a watch for packVar in the Expressions view, see here for more details.
POSTED BY: Ilian Gachevski
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract