Re: Short Circuiting + Return in procedures
- Posted by Lmailles at AOL.COM
Jun 25, 1998
Robert Pilkington wrote :
> No, he wants to do this:
> if s[1..] is "EOF", then do alpha, else do beta, but slicing makes it
> hard to do.
>
> Actually, with this code, to get the correct result:
>
> if find("EOF", s) then
> ... [alpha]
> else
> [gamma]
> end if
>
and pointed out that this was flawed. Dare I suggest replacing the first line
with :
if find(s,"EOF") then
--------------------------------
Jiri wrote that you can and always will be able to use return to escape from
procedures. This is funny because I recently got clobbered by the interpreter
for trying to "exit" from a procedure (Yes, I guess I learnt it from [excuse
my language] QBasic). However, we have
"exit"
from loops
"return"
from rountines and
"abort"
from main routine.
Is this not an unnecessary complication ? Would it hurt anyone to allow "exit"
from a procedure Rob ? I think that having "return x" in a procedure would be
extremely confusing for a newbie and hints of other inferior languages which
allow you to do naughty things like not returning values from functions.
-Daniel
|
Not Categorized, Please Help
|
|