RE: Unusual EU Problem (must see)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Juergen Luethje wrote:
> 
> 
> 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?>> smile
> >>>
> >>> 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.
> 
> 
<snip>

Hello again Juergen,

To help clarify this, forget about the past posts.
Write a short program with at least one procedure in it
and try to call it while you are tracing the program
with a line like this:

"return ProcedureName()"

without the quotes.

While you are tracing, the procedure called "ProcedureName"
doesnt get called, yet there is no error info.

If you dont trace, you do get the warning "statement after
return will never get executed".

Its the strangest thing smile  Take a look.

Take care for now,
Al

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu