Problem Description
The new zero-argument function auto-call feature introduced in PR #191 causes a behavioral regression for zero-argument functions invoked with explicit parentheses.
Current Behavior
When a zero-argument user-defined function is called explicitly with parentheses (e.g., my_action()), the following happens:
- The function expression
Expression::Variable("my_action", ...) is evaluated
- The new auto-call logic in
Expression::Variable immediately invokes the function and returns its result (e.g., Value::Null)
Expression::FunctionCall then attempts to treat that result as a function
- This results in an error like "Cannot call Null" instead of executing the action once
Expected Behavior
Zero-argument functions should work correctly whether:
- Referenced as a bare variable (auto-call):
my_action
- Called explicitly with parentheses:
my_action()
Both should execute the function once and return its result.
Impact
This is a critical regression that breaks existing code using explicit function calls with parentheses for zero-argument functions.
References
Affected Code
src/interpreter/mod.rs: Expression::Variable (auto-call logic)
src/interpreter/mod.rs: Expression::FunctionCall (callee evaluation)
This issue was created as a follow-up to code review feedback.
Problem Description
The new zero-argument function auto-call feature introduced in PR #191 causes a behavioral regression for zero-argument functions invoked with explicit parentheses.
Current Behavior
When a zero-argument user-defined function is called explicitly with parentheses (e.g.,
my_action()), the following happens:Expression::Variable("my_action", ...)is evaluatedExpression::Variableimmediately invokes the function and returns its result (e.g.,Value::Null)Expression::FunctionCallthen attempts to treat that result as a functionExpected Behavior
Zero-argument functions should work correctly whether:
my_actionmy_action()Both should execute the function once and return its result.
Impact
This is a critical regression that breaks existing code using explicit function calls with parentheses for zero-argument functions.
References
Affected Code
src/interpreter/mod.rs:Expression::Variable(auto-call logic)src/interpreter/mod.rs:Expression::FunctionCall(callee evaluation)This issue was created as a follow-up to code review feedback.