[Mathlib-develop] Function call glitch
Status: Beta
Brought to you by:
st_mueller
|
From: mark <msp...@ya...> - 2003-07-16 19:26:43
|
Hi
I've been look into why calling a function without brackets stops it from=
=20
displaying any results.
I found that the VariableToken.java contains the following lines
ErrorLogger.debugLine("VariableToken: var " + name + " not found: check=20
functions");
// If it is not a variable maybe it's a function or script-file
FunctionToken function =3D new FunctionToken(name, limitTokens);
OperandToken retValue =3D function.evaluate(null);=20
=20
// if the "function" is really a script it won't return anything
if (function.isMScript())
return null;
=20
>>>// check if a function has been evluated=20
>>>//(in case this functions returns null by default)
>>>if (function.isEvaluated())
>>> return null;
=20
if (retValue !=3D null)=20
return retValue;
since after evaluating a function function.isEvaluated() is always true, =
so=20
this always returns null.
Does anyone know if there is a reason for this check or if I can remove i=
t?
Also at one point we talked about allowing functions with parameters to b=
e=20
called without brackets - sin 2 rather than sin (2). However after thinki=
ng=20
about it there are two disadvantages
1 it makes the parser more complicated
2 it increases the chances of errors in user scripts
so my feeling (for this week ;-) ) is to only allow function calls withou=
t=20
brackets when there are no parameters.
What does everyone else think.
Best Regards
Mark Sparshatt
=20
|