Bug ASH does not verify that forward references are fulfilled

Veracity

Developer
Staff member
This script:

Code:
void hello();
{
    print("hello!");
}

hello();
print("good bye!");

is almost certainly not what was intended.
Which is to say, the coder wanted to define a function named "hello" and then call it.

Unfortunately, the ";" at the end of "void hello()" turned that into a forward reference and a block of top-level code.

Validation:

Code:
> validate forward.ash

void hello( )

Script verification complete.

No compile error, and, supposedly, there is a function in the namespace.
Cool, right? Not so fast.

Code:
> forward.ash

hello!
Calling undefined user function: hello (forward.ash, line 6)

The top level code executes - printing "hello!" - and then the supposed hello() function is called.
ASH detects - at runtime - that the (forward-referenced) function never did get defined.
 
Top