1. RE: Kat's goto
- Posted by euman at bellsouth.net Feb 05, 2002
- 549 views
David Cuny wrote: > Kat wrote: > > > I cannot afford to buy the code at this time, or i'd be > > adding a goto. > > Hopefully Robert's documentation will help with this. After all, it is > an > initial release. > > I concur with Bernie - I don't know any simple way to add a GOTO. But if > I > figure it out, you'll be the first one to get a copy of it! > > -- David Cuny Hi, Either Im totaly missing something about GOTO or I just havent had a real pressing need for them in any language I've tried out. I started out with Hyperkinetix, Builder in 1993 (I think 93) anyway, I found a few programs I wrote in builder back then and I did use "goto" but very little. Why should we even go there (I mean GO TO there) when we can simply use call_backs or routine_id to do the very samething a GOTO would do. I could possibly see a need if you perhaps wanted to setup a line number type scripting language but, there isnt a need for them in Euphoria. It really would confuse people I think if Eu had them. euman at bellsouth.net
2. RE: Kat's goto
- Posted by Kat <gertie at PELL.NET> Feb 05, 2002
- 485 views
On 6 Feb 2002, at 4:00, euman at bellsouth.net wrote: > > > David Cuny wrote: > > Kat wrote: > > > > > I cannot afford to buy the code at this time, or i'd be > > > adding a goto. > > > > Hopefully Robert's documentation will help with this. After all, it is > > an > > initial release. > > > > I concur with Bernie - I don't know any simple way to add a GOTO. But if I > > figure it out, you'll be the first one to get a copy of it! > > > > -- David Cuny Bless you, David, in your favorite religion of your choosing! > Hi, > > Either Im totaly missing something about GOTO or I just > havent had a real pressing need for them in any language > I've tried out. > > I started out with Hyperkinetix, Builder in 1993 (I think 93) > anyway, I found a few programs I wrote in builder back then > and I did use "goto" but very little. > > Why should we even go there (I mean GO TO there) > when we can simply use call_backs or routine_id > to do the very samething a GOTO would do. Routine_id isn't a reference point in nested If clauses. When i am writing a bit of http parsing, and the code refires with windose, for the same http file being recieved, a few gotos can save the day by simply saying "ok, we are at this point in processing the file at this event firing, do this and goto the end of the event. The only way i can see doing this without gotos is a slew of functions to call for each test, flow control vars, and repeatedly testing those flow control vars. > I could possibly see a need if you perhaps wanted to setup a line number > type scripting language but, there isnt a need for them in Euphoria. It > really would confuse people I think if Eu had them. > > euman at bellsouth.net No need for line numbers. Mirc has no line numbers. And no need for indenting either tho, which some other languages mandate. (Mirc and Eu do not have a CASE statement) food { if $istok(%food,%foodlist,$asc(;)) { goto %food } ; code to query user about their alledged "food" goto eofood -- because it's not food :cookie | sendcookies | goto eofood :cookies | send cookies | goto eofood :crackers | specifytype | goto eofood :pizza | offer types | goto eofood ; etc :eofood } (mirc and Eu do not have a REPEAT statement) repeat_test { :begin ; code to do things if ( conditions ok ) { goto begin } } (Eu doesn't have a GET_OUT_OF_5_LEVELS_OF_LOOPS_NOW or a BACK_UP_4_LOOP_LEVELS_AND_RESTART_THOSE_LOOPS ) nested_example { if _____ :top_loop if _____ if ______ if ______ if ( something) { goto top_loop } if whatever { goto eonested_example } } } } } } :eonested_example } One goto can get you out of the deepest nested code loops to one unique point, to continue processing at the place you need it to be. As you know, the C64 BASIC was line numbered, and the native GOTO went to line numbers. When i added :targets, i didn't limit where they could go, and i enjoyed the freedom of an interpreted language to edit in code to goto a variable target, a fixed memory location, a program location with a ":target" in it (even the middle of the numbered program lines) , and the ability to execute BASIC code that could be dumped into upper memory by the cpu in the floppy drive (which also gave the ability to execute variables). In short, GOTO can give you real inventive ways to get out of tight spots, and bypass long blocks of code. Same for long lists of tests on a variable, if it passes one test, no need to keep testing it, goto eotests and get on with it. GOTO can be a useful tool, rather like fire, to keep warm in emergencies, or misused, to burn garbage and give everyone downwind asthma. We don't outlaw the fire, we outlaw certain uses of it, like for burning garbage or arson. Likewise, GOTO can be restricted to targets inside the procedure or function it is invoked in, this should make implementing them easier too (at least in dos), since no one would write one procedure that is over a 64K memory block. While the sequences in Eu are great, i can get by without them in mirc because mirc allows me to build var names, without pre-declaring them. Running and tested mirc code for a scripted menu system, with built varnames and gotos: Delete Exeption:{ set -u0 %noi $$?="What number to delete?" if ( %noi == $null ) { goto eoDeleteExeption } if ( %noignore. [ $+ [ %noi ] ] == $null ) { echo @NoIgnore 4 $atime -- Error, i cannot delete mask number %noi , it doesn't exist! -- goto eoDeleteExeption } echo @NoIgnore 2 --- $atime Deleting --- echo @NoIgnore 12 %noi : %noignore. [ $+ [ %noi ] ] echo @NoIgnore 2 ------- set %noignore. [ $+ [ %noi ] ] :loopcompress if ( %noignore. [ $+ [ $calc(%noi + 1) ] ] != $null ) { set %noignore. [ $+ [ %noi ] ] %noignore. [ $+ [ $calc(%noi + 1) ] ] inc -u0 %noi goto loopcompress } set %noignore. [ $+ [ %noi ] ] :eoDeleteExeption } This: %noignore. [ $+ [ %noi ] ] is like this: sequence noignore noignore[noi] but in mirc, if %noi is out of bounds, there is no error, and i can build on more %noignore. [ $+ [ %noi ] ] just by specifying a new %noi index, including negative ones. Tested and running mirc code: Add Exemption:{ set -u0 %noi 1 :loopnoignore if ( %noignore. [ $+ [ %noi ] ] == $null ) { set %noignore. [ $+ [ %noi ] ] $$?="What mask to NoIgnore?" echo @NoIgnore 2 --- $atime Added --- echo @NoIgnore 12 %noi : %noignore. [ $+ [ %noi ] ] echo @NoIgnore 2 ------- goto eoAddExemption } inc -u0 %noi goto loopnoignore :eoAddExemption } Hence like i said 2 years ago, add in a few things mirc has, and Eu would beat the socks off it in *every way*. There are advantages to both mirc and Eu, but for most of my coding, i write far more mirc than Eu. Kat
3. RE: Kat's goto
- Posted by kbochert at ix.netcom.com Feb 06, 2002
- 515 views
-------Phoenix-Boundary-07081998- I have been following the goto debate with interest. I believe that the carefull use of goto is very useful for simplifying code and I intend to add it to the Euphoria source. I originally decided against it because it seemed very difficult, but after porting to LCC, adding initializations, slicing shorthands, and references, it now seems quite straightforward (should be about 2 days work). Using a translator to change goto's into structured code would be WAY beyond my capabilities. A sample of the syntax I will be using is: procedure foo() ... if ... then ... goto done end if ... :done: end procedure Surrounding the labels with ':'s helps them stand out. Labels and goto's will only be allowed in procedures or functions. Dangling goto's and unreferenced labels will be illegal. Forward and backward references will be ok. Karl Bochert -------Phoenix-Boundary-07081998---
4. RE: Kat's goto
- Posted by Kat <gertie at PELL.NET> Feb 06, 2002
- 518 views
On 6 Feb 2002, at 13:05, kbochert at ix.netcom.com wrote: > > > I have been following the goto debate with interest. I believe that > the carefull use of goto is very useful for simplifying code and > I intend to add it to the Euphoria source. > > I originally decided against it because it > seemed very difficult, but after porting to LCC, adding > initializations, slicing shorthands, and references, it now > seems quite straightforward (should be about 2 days work). Using a > translator to change goto's into structured code would be WAY beyond > my capabilities. > > A sample of the syntax I will be using is: > > procedure foo() > ... > if ... then > ... > goto done > end if > ... > :done: > end procedure > > Surrounding the labels with ':'s helps them stand out. > > Labels and goto's will only be allowed in procedures or > functions. Perfectly acceptable, but just out of curiosity, why not in the main? > Dangling goto's and unreferenced labels will be illegal. What if you put them in --label-- ? Then unreferenced labels will be treated like comments by default. Either way, as you like, i won't quibble over this one, since making them illegal also has good points. Dangling gotos are definitely a programming error tho. > Forward and backward references will be ok. > > Karl Bochert <giddy smile> Kat
5. RE: Kat's goto
- Posted by Ferlin Scarborough <ferlin_s at yahoo.com> Feb 07, 2002
- 540 views
gwalters at sc.rr.com wrote: > I'm with Kat. I'm tired of those obtuse sections that indent off the > page > and trying to draw pencilled brackets to make sure it's correct. Good > programming is readable and poor is not regardless of the style used. > BTW a > good language can satisify more than one style of programming. Each to > his > own and all are happy. > > George Walters Well I don't stick my nose in much on here, BUT, I have programmed in languages for YEARS that have GOTO's and Personaly, I'd rather trace through those structures that are RIGHT THERE in front of me, than to have to SKIP AROUND 150 pages of code to TRY and follow the path of a program. (OOOPS forgot where I started from, back there about 6 or 8 GOTO's ago) I hate that. Besides I put up with it because that's the way those languages were designed or the programmer programs, but TAKES TWICE as long to follow the code. As for Euphoria it's been a round for a few years now, and there have been Hundreds if not Thousands of SUCCESSFUL programs written without the use of ONE GOTO. There is an OLD saying. "If it aint BROKE don't FIX it." But like George said To each his own. Later. + + + Ferlin Scarborough - Centreville, Alabama - USA + + +
6. RE: Kat's goto
- Posted by Kat <gertie at PELL.NET> Feb 07, 2002
- 508 views
First: Karl, if you need help testing the goto version of Eu, and it's legal (Rob ?) to send it to me, i volunteer to use it as hard as you want me to. On 8 Feb 2002, at 0:05, Ferlin Scarborough wrote: > > > gwalters at sc.rr.com wrote: > > I'm with Kat. I'm tired of those obtuse sections that indent off the > > page > > and trying to draw pencilled brackets to make sure it's correct. Good > > programming is readable and poor is not regardless of the style used. > > BTW a > > good language can satisify more than one style of programming. Each to > > his > > own and all are happy. > > > > George Walters > > Well I don't stick my nose in much on here, BUT, I have programmed in > languages for YEARS that have GOTO's and Personaly, I'd rather trace > through those structures that are RIGHT THERE in front of me, than to > have to SKIP AROUND 150 pages of code to TRY and follow the path of a > program. (OOOPS forgot where I started from, back there about 6 or 8 > GOTO's ago) I hate that. That's the point, when i see "goto end_of_function_name, i know exactly where it wil go, no matter what code follows the goto. On the other paw, in a stack of elsif, one must follow every indent and every else and elsif and end if to see where the program is going next! I used repeat() more than while() anyhow, and that's not in Eu either, but i can do it in mirc, of all languages, with the goto. No one is going to write a program that is 150 pages long in one procedure anyhow, not even me, and i have been coding for YEARS (decades, really) too. > Besides I put up with it because that's the way those languages were > designed or the programmer programs, but TAKES TWICE as long to follow > the code. As for Euphoria it's been a round for a few years now, and > there have been Hundreds if not Thousands of SUCCESSFUL programs written > without the use of ONE GOTO. And even more were written WITH goto. If not in the high level language, in the underlying maching code. Try to write a useful machine code program with no goto (aka JMP), i dare you. Since goto is so bad, i think it sould be removed from all assy code too. Sheesh. > There is an OLD saying. "If it aint BROKE don't FIX it." Well, slavery wasn't broke, and Alabama would like to see that back. Not enforcing pollution laws works fine too, why change that in Alabama? The political system seems to work as designed in Alabama too, with so many politicians under investigation, indicted, or jailed,, and the same for preachers. Misusing $40Million last year in federal road taxes to blow on childrens' museums and building renovation happened too, despite the mess in Malfunction Junction and Death Valley, just two of the fond names for places on the highway system in Alabama. The Alabama constitution isn't broke, it is working as businesses have designed it, why rewrite it? "Broke" is relative, but does have an area where it means something, and it isn't applicable in this situation. Eu isn't "broke". If i design a pie with Ritz crackers, whipped cream, and cow patties, you can't say it's "broke", but you could say "it seems to lack something", or "the ingredient proportion needs to be changed", or something like that. But as designed, it's not broke. Malfunction Junction works as designed, why fix it so people do not *need* to dodge across 6 lanes of an interstate highway to get to the 4th Ave exit ramp from I-20&I-59 across I-65? I mean really, sheesh, just because one tanker blows up and takes out a bridge?? That pavement isn't broken, and neither is the pavement in Death Valley, even if the state patrol says they get 20 accidents per thunderstorm there and 2 deaths per week! If it's not broke, don't fix it! > But like George said To each his own. Yes, if i want to drive well, not burn garbage, not rip off tax payers, and use "goto" properly, that's my choice. > Later. > > + + + Ferlin Scarborough - Centreville, Alabama - USA + + + Kat, grrrrrrr
7. RE: Kat's goto
- Posted by Rod Jackson <rodjackson_x at hotmail.com> Feb 08, 2002
- 541 views
void wrote: > Please just add it, so people can decide for themselves. > > In principle I'm against GOTO, but I agree sometimes it would make life > more > simple. In rare instances it makes code more readable and efficient. If > it's > implemented I will replace some ugly pieces in my coding too. I... DO NOT... get this! Is it really so hard to see what's cropping up here? First pass-by-reference, now GOTO, in a matter of days. What next, pointers? A built-in 'string' type? The ability to directly execute text? Pre-initialization of variables? Zero as a valid index subscript? When these fundamental changes are all implemented, for everyone, in the core language, should we rename the language, say, to IAHPLUSS (Inconsistent, Ad-Hocked Prog Lingo Using Sequences and Strings)? Sheesh indeed... I wonder if Python's creators have this problem: "Add sequences. Euphoria has it, and I want it in Python." "Add a built-in Picture type. 4D has it, and I want it in Python." "Add the ability to rename built-in symbols. Forth has it, and I want it in Python." "Add pointers. C has it, and I want it in Python." "Add <pet feature>. <Alternative language> has it, and I want it in <language of choice>." If you can't add it yourself (via source code or writing a library), why not just use a language that has what you need, if the need is so great? If it's not that necessary, why change the essense of the language (which a GOTO would *definitely* do) for everyone else by requesting the needed element be affixed to it??? Rod Jackson
8. RE: Kat's goto
- Posted by "C. K. Lester" <cklester at yahoo.com> Feb 08, 2002
- 551 views
> Everybody potentially benefits from reasonable enhancements, they > improve the expressive power of the language, they give us more > freedom to say whatever we have to say in better ways. It's called > progress. Carrying this line of thinking further, a "better" language would lead to more users (one would hope), and, therefore, a larger brain pool. However, I don't expect I'd ever use a GOTO. So whatever.
9. RE: Kat's goto
- Posted by Rod Jackson <rodjackson_x at hotmail.com> Feb 10, 2002
- 526 views
Jiri Babor wrote: > Rod, > > I have always enjoyed your contributions and would hate to see you in > the ever increasing camp of my enemies, Well, thanks, I try. (Not wanting a GOTO would make me an enemy?) > but I find your last couple of > intolerant notes really disturbing. They're not meant to be, but I can see how they can come across as something similar to 'intolerant'. But I didn't want to chase rabbits about performance issues, etc., I wanted to get to what was for me the heart of the issue. > >I... DO NOT... get this! Is it really so hard to see what's cropping > >up here? > >First pass-by-reference, now GOTO, in a matter of days. > > Would you prefer to allow us just one request for enhancement per > person every couple of years? Actually, a slowdown would probably be a good thing. At the above rate, by year's end Euphoria will be unrecognizable. Yes, I know people have the right to ask for them--I'm not asking for a censorship of such ideas on the list--but then I have the right to express frustration with their requests, yes? Particularly when it seems like the issue is pretty much settled... Rob doesn't want GOTO, and someone else has already coded it themselves. Seems like a fine solution. >And, ignoring often quoted > semi-religious academic arguments, what's wrong with > 'pass-by-reference'? It's a very useful tool that would allow us to > do, very efficiently, what we simply cannot do now. The same goes for > the 'goto'. The safety aspects? Well, we do not ban cars because > idiots keep killing us and themselves with them... I'm not really against them because they're that unsafe--although I do think GOTO is rather ugly. I'm against it because they seem to strike at some core principles of the language, principles that drew me to it (more on that below.) Plus I still don't see how they allow anything that's impossible without them now. <snip> > >If you can't add it yourself (via source code or writing a library), > >why not just use a language that has what you need, if the need is so > >great? > > Everybody potentially benefits from reasonable enhancements, they > improve the expressive power of the language, they give us more > freedom to say whatever we have to say in better ways. It's called > progress. Mmm, yes, I understand THAT part of it... but some 'enhancements' can cause more trouble than they'll give benefit, and can actually hinder the expressive power of the language (IMO, yes.) I wouldn't call a GOTO progress in that regard. > >If it's not that necessary, why change the essense of the language > >(which a GOTO would *definitely* do) for everyone else by requesting > >the needed element be affixed to it??? > > What's the essence of the language that a 'goto' would so irreparably > damage? It looks you were talking some sort of metaphysics there that's > way beyond me... Okay, consider. Euphoria: -- has no direct forward references (just an explicit work-around) -- has only two loop constructs (only had 1 for a while) -- forces structure upon programmers -- has a syntax and style that is rather elegant If someone came to me and said that some language existed with those qualities, and asked if I thought it had a GOTO in it, I'd probably answer, "No, I don't think so, but if it does it's probably only usable in an extremely restricted fashion. An unhindered GOTO wouldn't seem to fit the rest of that design." *That's* part of my point. It seems apparent to me that the language isn't designed with the kind of mindset that would put in a GOTO (that wasn't an attack, just an observation.) I'm used to thinking about it in its current fashion, which seems very consistent. The thought of downloading a neat new library and finding GOTOs strewn everywhere makes me uneasy, considering what I'm used to finding when I look at Euphoria code, and considering that GOTOs just aren't necessary. (I know, I know, structured code can be unwieldy too, but I deal with that better, and since Eu already allows that, I don't see how adding GOTO to the mix will do anything but make that situation worse.) Maybe I need to spend more time being on the 'ground level' of a new language, but right now the prospect of asking for a change like a GOTO in the language just seems so out-of-place. Like walking into a fine-dining Japanese restaurant and asking--not that they cook a batch just for you--but rather that they put 'chitlins' *on the menu*. It strikes me as just as bizarre. Rod Jackson