1. rE: Language Design

In my idEu project, I stopped coding while debugging the implementation of=
 goto.
Quite a hell really. Since I now contribute at an unexpectedly high level t=
o
the OpenEuphoria
project, this code is just sitting on the HD, waiting either for OE or EU w=
ith
useful features
to start flying.
	goto is not improper by itself, since all asm code use it without any othe=
r
alternative left. But it is probably too tricky to implement and leads too
easily to unmanageable/unmaintainable code, compared with its usefulness.
	I just object to having to understand gotoed code, and I'm free to refrain=

from using the statement. Controlled gotoes (generalized exit/next/retry/..=
.
to start/end of control blocks) seem to be much more useful, easy to
understand and safe to implement. Just a coder's opinion.

CChris


> Subject: RE: Language Design posted by: Brian Broker <bkb at cnw.com> Der=
ek Parnell in response to:
>
>>> Kat wrote:
>>
>>>> >
>>>> > On 28 May 2004, at 1:53, Ricardo Forno wrote:
>>>> >
>>>
>>>>> > > I agree wholeheartedly.
>>>
>>>> >
>>>> > So is that TWO votes in favor of "goto" in Eu ?
>>>> >
>>
>>> Well...I won't actually object to it being included, but just
>>> don't expect me to ever use it, or to trust a program that
>>> does use it
>>>
>>> --
>>> Derek Parnell
>>> Melbourne, Australia
>>>
>
> Nor would I choose to help to debug such a program...
> -- Brian
> (just my 1=A2)

new topic     » topic index » view message » categorize

2. rE: Language Design

On 28 May 2004, at 14:34, Christian Cuvier wrote:

> 
> 
>  In my idEu project, I stopped coding while debugging the implementation of=
>  goto.
> Quite a hell really. Since I now contribute at an unexpectedly high level t= o
> the OpenEuphoria project, this code is just sitting on the HD, waiting either
> for OE or EU w= ith useful features to start flying.
>  goto is not improper by itself, since all asm code use it without any othe= r
> alternative left. But it is probably too tricky to implement and leads too
> easily to unmanageable/unmaintainable code, compared with its usefulness.

It's actually easy to make it happen if you follow the example of Turbo 
Pascal: each and every loop is an external call, and goto is treated like an 
exit until the target is found. In this way, each nested loop in the path to the
target is allowed to clean up after itself normally, and since RobC already 
added the exit code, a goto is trivial to add. The compiled code all sees it as 
a single-level exit, that just keeps exiting until the target is found.
Ironically, if
there is no target found, a line like "goto end" would simply fall thru to the 
bottom of the procedure it's in and the procedure would return normally, 
returning to normal program flow with no errors (unless you add error code).

 And if you have multiple ":next" targets, "goto next" would stop exiting at 
the first ":next" it hits, if you want a general purpose x-level exit command 
like that:

for loop = 1 to whatever do
  while blah do 
    if this then
        -- code
     if blahblah then goto next end if
        -- more code
    end if
    :next

  end while
  :next

end for
:next

Same goto gets you all your loop exits. Lets make it exciting, and allow 
wildmatches in exit targets! So "goto next*" matches ":next1" and ":next2"!

Kat

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu