RE: Unusual EU Problem (must see)
- Posted by Al Getz <Xaxo at aol.com> Aug 17, 2003
- 389 views
Pete Lomax wrote: > > > On Sat, 16 Aug 2003 19:18:12 +0000, Al Getz <Xaxo at aol.com> wrote: > > >with trace > >trace(1) > > > >procedure DoThis() > > ?1 > >end procedure > > > >procedure DoThisToo() > > ?2 > > return DoThis() > >end procedure > > > >DoThisToo() > >----------------------------------- > > > >--Note that in line 10 when DoThis() is called > Ah! There is your misunderstanding. > Line 10 is not executed. > The "return" on line 10 is executed, not "return DoThis()". > OK, it is quite confusing, a good example of bad coding style making a > program virtually unreadable, and also a good reason to avoid the evil > "without warning" and/or ignore those pesky helpful hints Eu tries to > give you once the program finishes > > Your example is the opposite of: > > ?4 > > + > > 5-3 > > * > 10 > > which prints -21 (think about it, not 4 and an error, and not 60 or > perhaps even 24, which are other ways a human might read it...) > > and your example is a bit similar to: > > function max(integer a, integer b) > if a>b then return a else return b end if > end function > > Maybe someone should write a style checker for Eu code. > HTH > > Pete > Hello Pete, You've hit the nail on the head It's not a matter of style, however, because the warning isnt correct either. The warning starts out "the line *AFTER*..." note the use of the word 'after'. In the line: "return DoThis()" in my sample code, 'DoThis()' is in the SAME line as the 'return' statement. When i saw the warning, i was looking for code after the return statement. The only problem now is that my sample code wasnt correct. Here's a corrected version: ----------------------- --in 3 year old file: global procedure DoThis() --was once a function ?1 end procedure ----------------------- --in new file: with trace trace(1) function DoThisToo() ?2 return DoThis() end function x=DoThisToo() ------------------------ Take care for now, Al