metafacture / metafacture-fix

Work in progress towards an implementation of the Fix language for Metafacture
Apache License 2.0
6 stars 2 forks source link

Runtime-Error of non-used function not spotted. #150

Open TobiasNx opened 2 years ago

TobiasNx commented 2 years ago

See here

do list(path:"animals[]", "var":"$i")
    if any_equal("$i.name", "Peter")
        replace_all("$i.name", "T_E_S_T")
    end
end

replace_all only has two variables needs to have three. It breaks only if the conditional is met. If not, the syntax error is not causing an error.

I think this should cause an error earlier. I had a test set of 200 records and it did not spot the error because the condition was not met.

After deploying and testing all source data it broke since the condition was met.

Syntax errors of needed attributes of an function should cause an instant error as a missing end would cause.

blackwinter commented 2 years ago

This would only be possible if all possible functions were defined in the grammar. As it is implemented currently, functions and their arguments are not evaluated before actually being executed.

Syntax errors of needed attributes of an function should cause an instant error as a missing end would cause.

Missing parameters aren't syntax errors, but runtime errors.

(Aside: We should definitely do proper parameter validation at some point, but that's still at a later stage than what's asked here.)