Re: Unusual EU Problem (must see)
- Posted by Juergen Luethje <j.lue at gmx.de> Aug 16, 2003
- 473 views
Al wrote: > Juergen Luethje wrote: >> >> >> Al wrote: >> >> <snip> >> >>> function FunctionAAA() >>> atom param >>> param=1 >>> return FunctionBBB(param) >>> end function >>> >>> Looks normal, doesnt it? >>> Well, you would think so anyway...but >>> >>> FunctionBBB() never executes! >>> >>> Why not? >>> >>> procedure FunctionBBB(atom param) >>> ?param >>> end procedure >> >> <snip> >> >>> but no real error comes up as usual in Euphoria. >>> <<Now why cant that happen with an invalid sequence arg?>> >>> >>> Shouldnt there be an error message or something? <big snip> > Yes, the function (procedure) gets declared beforehand of course. > The strange thing happens when you try to call a procedure with > "return ProcedureName()" > as the procedure never gets called, and you dont even see that > warning you were talking about until you stop debugging > (from trace mode). You did not mention before that you were using trace mode. With your both routines in the intended order, and using trace mode, we have: ----------=----------=----------=----------=--------- with trace trace(1) procedure FunctionBBB(atom param) ?param end procedure function FunctionAAA() atom param param=1 return FunctionBBB(param) end function FunctionAAA() ----------=----------=----------=----------=--------- > Now i know what to look for, but before i found that i didnt > know what was causing the problem, so i thought i would > mention it so it could raise an error in 2.5 perhaps. Running my code above, exw.exe 2.4 says: Syntax error - expected to see an expression, not a procedure return FunctionBBB(param) ^ So there _is_ an error message. You wrote: | try to call a procedure with | "return ProcedureName()" | as the procedure never gets called This is neither true nor false, but it depends. If the statement "return ProcedureName()" is inside a _function_ (as in your code), then Eu _does_ try to call "ProcedureName()", and correctly raises an error, because the correct syntax is "return <expression>", and the name of a procedure is not a valid expression. If "return ProcedureName()" is inside a _procedure_, then these are actually _two_ statements. We better write: return ProcedureName() That's the same for Euphoria, but I think humans so can better see the difference between this and "return <expression>", as used in functions. Therefore again I guess -- as Pete and me did before, but you neither confirmed nor contradicted -- that the code you posted is _not_ the code, that you used in your program. _If_ you actually used "procedure FunctionAAA()" instead of "function FunctionAAA()" then I see what you mean. AFAIK warnings are _never_ shown until the end of the program (CMIIW). Your point is, that inside a procedure return ProcedureName() should raise an error rather than a warning, right? Best regards, Juergen -- /"\ ASCII ribbon campain | "Everything should be made as simple \ / against HTML in | as possible, but not simpler." X e-mail and news, | / \ and unneeded MIME | [Albert Einstein]