Reserved Word Warning


Recommended Posts

Today I was moving code from some old sequences into a single new sequence with a switch statement. The old sequences were being called by some variable value components and worked well.  I updated the components to call my new sequence and DAQFactory locked up.


Sequences that demonstrate this problem are attached.



It is interesting that the old code works well but a lockup occurs if I use the case statement (with the variable declared outside the switch code).  The problem seems to stems from the use of 'time' as a variable name (since 'time' is likely a reserved word).  It might be a nice future feature to have the parser fail with a warning if a reserved word is declared.  Not sure why DF hangs.


Link to comment
Share on other sites

You are correct, the issue is that "time" is a reserved word used for a deprecated form of scripting in place of wait().  The compiler is confusing your time with the Time statement, which, since its not used correctly causes a wait forever.  Since you are calling this from the primary thread of DAQFactory (the UI), the program hangs because the script gets stuck at that line and never returns.  DAQFactory is not actually hung.  Any other sequences, logging, data acquisition would still run.  Just the UI would freeze.


Why it works in one script and not the other I can't say.  Its some fluke of the script parser. 

Link to comment
Share on other sites

  • 1 year later...


This topic is now archived and is closed to further replies.