Re: [Mathlib-develop] Path Function & problems with funcion calls
Status: Beta
Brought to you by:
st_mueller
From: mark <msp...@ya...> - 2003-02-21 21:30:28
|
On Thursday 20 Feb 2003 7:40 pm, Stefan Mueller wrote: > > While testing it I notived a problem with function calls > > > > entering > > > >>path > > > > runs the path function and sets the ans variable but doesn't display > > anything > > > > while entering > > > >>path() > > > > displays the result of the function call. > > I'll have a look into it. > > Kind regards, > Stefan. This seems to be connected to the function being treated as a variable ra= ther=20 than a function when the brackets are ommitted. There is a similar problem if there is a space between the function name = and=20 the brackets. If you enter >sin (5) then you get a null pointer error. After checking it seems that MathLib treats VariableTokens and FunctionTo= kens=20 in the same way. It first checks for a variable with that name then for a= =20 function. Therefore it might be an idea to combine VariableTokens and FunctionToken= s=20 into one class (Say ReferenceToken) since this would ensure consistent=20 behaviour regardless of how the function or variable is entered. One difficulty is the fact that VariableToken descends from OperandToken = while =20 FunctionToken descends from OperatorToken. RefereenceToken would have to = be a=20 subclass of OperandToken which would mean that it would have to store any= =20 parameters being passed to the variable or function. Though this would have the advantage of making functions more consistent = with=20 keyword functions such as IF and WHILE. Best Regards Mark |