I have a question/comment/observation concerning bracket positioning in control flow statements for labtalk. I have noticed on several occasions that Origin (6.1) encounters a run-time error while executing a script depending on the typesetting of brackets in the input labtalk script file. For example, compare the following two code fragments
loop(ip,1,10)
{
loop(jp,1,10)
{
Type My loopstuff goes here;
};
};
versus the following
loop(ip,1,10){
loop(jp,1,10){
Type My loopstuff goes here;};};
Note that these code fragments are too simple to produce the errors I have encountered. I hope they are sufficient to illustrate the formatting style difference.
I have found that Origin will often produce run-time errors, sometimes so catastrophic that the Origin session terminates completely, when I use the former method of typesetting the script, but not when I use the latter method of typesetting the script. Personally, I find the former method to be much easier to read and debug, especially when loops and if/else statements span many editor screen pages.
I have also noted that the crash is more likely to occur if the script is run from a user-defined button instead of from the script window.
I am pretty sure the error is not due to general program logic error (script bug), lack of semi-colons where they should be, etc. I have had this type of run-time error occur so many times under different circumstances that I now just typeset my Origin code using the latter method and everything is ok. I would still like to be able to use the former typesetting format, though.
Has anyone else noticed this?