cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Using Namespaces to Avoid Variable Collision and Allow for Cleaner Scripting

Vince Faller, Meteorology Engineer, First Solar

Since the inclusion of namespaces in JMP, scripting has become much easier to do without the need to worry about creating unique instances of variables. This becomes especially viable in longer scripts where references to multiple objects need to be kept and recalled easily. It allows for the segmenting of code, when namespaces are combined with include(), into bite-sized chunks that can be more easily read by others. Garbage collection of entire chunks becomes much easier, using one variable instead of listing out all the specific variables to be cleared. The use of the Here namespace is especially useful in this regard. It allows libraries of user-defined functions to be made that won’t be accidentally cleared by a user. At the same time, this namespace will allow those variables to not be locked as well. This has the benefit of not crashing another user’s script if it uses the same variable name without the need of superfluous Try()s. I’ll walk through the many benefits of namespaces, discuss the current limitations of them, and talk about some methods for dealing with those limitations.

Comments
maram007

It will be great to have a video or full paper to get concept

Discovery Summit 2015 Resources

Discovery Summit 2015 is over, but it's not too late to participate in the conversation!

Below, you'll find papers, posters and selected video clips from Discovery Summit Europe 2015.