Re: The fate of Euphoria

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

----- Original Message -----
From: "Kat"
Sent: Monday, November 08, 2004 8:35 PM
Subject: Re: The fate of Euphoria


> 
> 
> On 8 Nov 2004, at 10:36, Ferlin Scarborough wrote:
> 
>> 
>> posted by: Ferlin Scarborough <ferlin1 at bellsouth.net>
>> 
>> Mike Nelson wrote:
>> > 
>> > 
>> > > It's another goto in disguise. So is the elsif, for that matter. Picture
>> > the little
>> > > goto at the end of each elsif that executes in that stack of
>> > > if-elsif-end,
>> > where
>> > > the goto points to the end of the stack.
>> > 
>> 
>> I tend to somewhat disagree with this, CASE is a glorified If...ElseIf
>> statement. You are not really going anywhere, you are saying in the CASE
>> where
>> this is equal to this, then do this code.  Not goto this other place.  
> 
> Yes it does. After hitting the first valid case line, it goto's the endcase
> line.
> Same with the elsif, once a line (or block) is executed, no more of the 
> if..elsif..end is tested, it does a goto the end if.
> 
>> Your
>> program does not head off in some other direction it still falls through the
>> CASE statement to the following statement(s).
> 
> Hmm, some languages must be different then. From my experience only one 
> case is triggered (if any is), and only one elsif is triggered (if any). After
> that,
> the flow does a goto the end statement.

Ah, but that is only the case when any but the last if or caset test 
is true.
If not of the following are true then it will check every single case.
SO, order of testing is important. During speed optimizing you will 
want the
test that is most likely to be true to be near the top.  A profiling 
counter can
help determine that.  Of course.  If any of the earlier items are true 
then,
execute withing that truth block and continue directly after the end if
statement.

if a then
elsif b then
elsif c then
elsif d then
...
elsif z then
else
end if

>> > On the assembly language level, yes it is. That is of no concern to the
>> > programmer, however. This code
>> > 
>> > if x then
>> >     do_1()
>> > elsif y then
>> >     do_2()
>> > else
>> >     do_3()
>> > end if
>> > 
>> > or the equivalent case statements simply do not have the same power or
>> > potential for abuse as goto:
>> > 
>> > 
>> > if x then
>> >     goto skip
>> > end if
>> > --- 50 other statements
>> > 
>> > : skip
>> > -- 100 other statements
>> >
>> <snip> 
>> > -- Mike Nelson
>> 
>> My biggest beef with the goto statement is that it is usally highly abused,
>> sometimes to the point where the program is literally unreadable, by the time
>> you figure out where all those jumps are going to, you could have totally
>> rewritten an application just like it.
> 
> But if you code like that, you which to deny me the use of it, even if i use
> it
> properly? You must have voted for Bush.
> 
>> We really don't want to start the goto wars of 4 or 5 years ago on here,
>> it tended to get pretty nasty, and ending up with each side pretty much
>> saying, this is my opionion and I'm sticking to it, as stuborn as I am.
>> 
>> Euphoria has lastest this long without the need for a goto, and it will
>> survive even longer with or without it.  Right now without it, the programs
>> are
>> much cleaner.
> 
> Not really. I have had to make some aweful messes with Eu, and gave up 
> and did it faster and cleaner in mirc with goto. Goto is just a program flow 
> control, you don't haveto control your code that way if you don't wish to. But
>
> goto can replace the exit(), break(), restart(), resume(), repeat and while 
> loops. And without goto and access to loop control vars, i stilll haveto use a
>
> "while 1 do" to make a loop i have better control over, than use a for loop. 
> With goto, i wouldn't haveto abuse the while that way. Not in Eu, but i have 
> had to wrap up blocks in *both* repeat-until and while-do when a single goto 
> would have been enough.


I still do not like GOTO yet I have come to understand a few cases where
it can be used properly.  However, Most of those cases can be gotten 
around
with additional control structures added.
Hmm. Sounds anti-RISC.  Lets add 4 or 5 commands to avoid using 1 command.
Sounds sort of brain-dead.  Eh, oh well.

> Just because you don't want to drive a hybrid car doesn't mean they should 
> be illegal. But you don't haveto drive one.

     unkmar

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

Search



Quick Links

User menu

Not signed in.

Misc Menu