The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 permissibility of the underscore in LabTalk identi
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

drreaf

Germany
45 Posts

Posted - 11/30/2009 :  05:11:05 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release :Pro 8.0 SR6
Operating System: XP Prof.

In the context of a recent troubleshooting I was advised by your German distributor to strictly avoid any usage of the underscore, “_”, in identifiers of LabTalk scripts and names of Origin C function names to be called from LabTalk.

Given that this would further impair the ‘readability’ of LabTalk, I would like to know the exact limits of the restriction to use the underscore, before I begin the task of re-naming those identifiers where I did use the underscore – so far without any apparent negative consequences.

Here some examples, where I use the underscore without troubles so far.

Section names:

[XYZbelt_EXP_SETUP], [TLD_WEIGHTED]

Numeric or string variables:

XYZbeltScA_S=4.07996; //scan area in cm^2, belt short etch
XYZbeltScA_L=4.03014; //scan area in cm^2, belt long etch

DENSITY_DosesLong$ = XYZbeltLc; // worksheet-name to take up results of the DENSITY analyis

Origin C function names to be called from LabTalk:

double LET_vr(double v_r, double No );
double invLET_vr(double LET, double No );
double LET_curve(double No, string abs, string ord );

Which are to be avoided?

Many thanks in advance, Rainer

Rainer Facius, German Aerospace Center

cpyang

USA
1406 Posts

Posted - 11/30/2009 :  10:35:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There is really no issue with using underscores in your LT code.

The only issue is that you should not use the book_col notation for dataset, as they are not reliable.

If you do not have any assumption in your identifier names with regard to bookName_colName, then you should not need to change anything, as underscore is perfectly fine as a naming character.

Maybe your German distributor thinks these identifiers with underscore might be confusing to read as one might want to interpret them as the old style dataset names that we now recommend people not using anymore, as I had pointed out above.

So if you want to avoid underscore to prevent such confusion, I would suggest numeric variables; as they are the only type that might lead to such confusion, like:


book1_b = Test_result * 2;


In most cases, your numeric variables should be declared for a local scope and thus can use shorter and more generic names, like ii, jj, kk, ff etc. If the scope is local within a few lines, such variable names often are better to indicate their limited life time, and longer variable names are then reserved for session or project scope variables.

CP
Go to Top of Page

drreaf

Germany
45 Posts

Posted - 11/30/2009 :  12:22:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot.

Your clarification saves me some hours of renaming.

Regards, Rainer
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000