RX0066

Domain: Parsing

Error message

Symbol %s is invoked before it is declared. Rush does not support forward references (%s)

In the message, %s marks a value that the engine fills in when it raises the error.

The story

You called a function that is defined later in the file, and the engine told you something specific: rush has no forward references. Let me explain why. In rush, the order of declarations is the dependency graph. A function can only use what has already been declared above it. That makes a script easy to read from top to bottom, because every name you meet has already been introduced. Now, the engine could have said unknown builtin, but that would send you hunting for something that was never supposed to exist. The truth is that the function does exist, just below. So the message names the symbol and tells you what really happened. One consequence is that two functions calling each other, mutual recursion, is impossible by design. If you need that shape, restructure it so the dependency goes one way only. The fix for the usual case is easy: move the declaration above its first use. Define it first, call it second, and the script will read like a story, in order.

Text from the Rush engine's error catalogue.