cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Ressel
Level VI

What's the deal with leading underscores precisely?

I realize (yet again) that this is a noob question, but I don't find it adequately answered in the Scripting Index.

 

  • As regards the use of two leading underscores, the Scripting Index is clear: To hide (or protect) a global variable, put two underscores (__) before the name. (Also something explained by Mauro Gerber during the last Scripter's Club session.)
  • When it comes to single leading underscores, the Scripting Index (or at least what I found) was far less informative: 
    • If the name begins with an alphabetic character or underscore, ... . OK, so a name can begin with an underscore
    • Copied from the section on Limits Data Table: The next three columns need to be named LSL, Target, and USL. These column names can also be preceded by an underscore character

So, all the Scripting Index tells me is that a single leading underscore can be used, but not for what purpose. The only hint I found (after lazily employing Google) was related to Python, where a leading underscore hints at a variable being used internally. Does that also apply to JSL and what is the use of leading underscores in connection with Limit Tables?

 

 

1 REPLY 1
jthi
Super User

Re: What's the deal with leading underscores precisely?

To my knowledge single leading underscore is just convention some people use and it is mostly up to you how you want to use them (or not). There might be some places which use specification limits that can get messed up due to lsl/_lsl/usl/_usl variable names, but I cannot remember anymore where they were (and the issue might have been fixed).

 

Quality and Process Methods > Process Capability > Enter Specification Limits for a Process > Spec ... 

A wide table contains three rows and one column for each column analyzed in the Process Capability platform plus a _LimitsKey column. In the _LimitsKey column, the three rows need to contain the identifiers _LSL, _Target, and _USL.

 

Scripting Guide > JSL Building Blocks > Global and Local Variables > Hide a Global Variable 

To hide (or protect) a global variable, put two underscores (__) before the name. Protecting a global variable means that it will be hidden and can not be examined or shown. However, the behavior is different depending upon the context.

 

Scripting Guide > JSL Building Blocks > JSL Syntax Rules > JSL Rules for Names 

Names must start with an alphabetic character or underscore and can continue with the following

-Jarmo