Unreported Sequence Errors

Recommended Posts

Quick sequences are just sequences attached to the event of a component, so act identically with every other piece of script. The only difference is that they run in the user interface thread of the application, so must be FAST or DAQFactory will appear sluggish (or hung).

But to the point: DAQFactory doesn't generate errors if you try and assign a value to a null (or undefined) variable / object. So, while:

? y

will generate an error if y doesn't exist,

y = 3

will not.

Silly? I suppose, and thus the reason I'm moving this to the Feature Request forum.

Link to comment
Share on other sites

That is actually a symptom of an interpreted language, especially one that is dynamic like DAQFactory (meaning variables are declared and destroyed over time even if the scope is not). Because of this, DAQFactory can't check that every variable exists, and only checks when the command actually executes.

In this case, string isn't really a reserved word. You can actually declare a string variable named "string" if you want. Try this at the command/alert to see:

global string string = "abc"

? string

"string" is only looked for by the parser when determining function variable types or in variable declarations. That's why you actually can't declare a numeric variable called "string" (i.e. 'global string'), but can declare a string variable. The parser ignores the second string and treats it as the variable name.

Link to comment
Share on other sites

OK, interpretation does add some wrinkles. So Quick Sequences are not Applied & Compiled when we click OK?

Should we expect the compiler to report an error when a parameter is passed with a space character in the 'name'?

That is, assuming the Function Sequence were declared with two parameters incoming, would the 'correct' syntax have been: LogImport(string, strLogFilePath) rather than: LogImport(string strLogFilePath)?

I ask these clarifying questions since I'm currently working on a develop-as-we-test system (not the optimal strategy, truly!), and I'm sometimes tasked with modifying our application when on-site and facility personnel are present and watching. It helps me to know what pitfalls may await my careless typing (and try to remember them) as I attempt to add features on-the-fly for better usage of the research facility time, which charges as the clock ticks.

Thanks for your assistance!

Link to comment
Share on other sites

1st question: yes that is expected and falls again under the dynamic, interpreted language clause. If you are used to dealing with compiled languages like C++ or VB then it can be confusing. If you are used to JavaScript, then you'll understand as it has the same sort of behavior. Anyhow, the compiler doesn't generate an error when you type:

privae Channels

because it doesn't know you meant "private", but rather thinks you have some object or something with the name "privae". At runtime it can't find anything by that name and throws an error.

2nd question: no, partially because reserved words vary a little depending on scope and location. You can basically review the sequences chapter and look at the command names listed there. Some, like "string" are not completely reserved, but you want to avoid. Others you must avoid. One I can think of that may not be listed there is "Value". "Value" has special meaning in expressions, mainly Conversions, so can't be used.

Link to comment
Share on other sites

You asked a 3rd question while I was responding to the first two. So here you go:

If LogImport() was a function that took two parameters, and "string" was a variable that you had declared, then the correct format to call the function would be:

logImport(string, strLogFilePath)

while the declaration of the function might be (though matching variable names is not required of course):

function logImport(string string, string strlogFilePath)

If however, logImport() took just one parameter with the path, it would just be:


while the declaration would be:

function logImport(string strLogFilePath)

As for the interpreted part, try and think of everything as just-in-time compiling. When you do apply/compile, the sequence is compiled, but really its just the parsing part of compilation. It takes the string that makes up the entire sequence and breaks it down into psuedocode which executes much faster. The psuedocode isn't processed until the line actually executes. So, you'll only get errors at compile time if there is something that throws the parser, like a missing ) or similar, but not things like variables not declared, etc.

I should also add that doing evaluate() or execute(), causes both the parsing and executing to happen at runtime, and is thus quite a bit slower. So:

execute("global x = 3")

is much slower than:

global x = 3

because when the execute line runs, it has to parse the enclosed string.

Link to comment
Share on other sites

Sure, have used, and in some cases written and used, compiled, interpreted, and table-driven systems, as well as hybrids of all of these, so the properties of each are not news to me (though sometimes forgotten in the rush of things, or switching between very different types of development environment) :P

Presumably, committing a Sequence enters declared entities (variables and functions prototypes) into a symbol table of some sort.

Would it be possible to run the Interpreter against Sequence code at commit time in an error-reporting mode only, where the Interpreter would compare variable references and function parameter/return signatures against the symbol table and report exceptions then?

Link to comment
Share on other sites

Actually, there isn't really a symbol table per se. More like a symbol tree. The problem is that the system is so dynamic. For example, what about channels that haven't been read yet and therefore have no data?

Anyhow, these are good things to think about for new releases, so we appreciate your comments.

Link to comment
Share on other sites


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