Why doesn't JavaScript have a goto command?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tim Streater

    #16
    Re: Why doesn't JavaScript have a goto command?

    In article <1141775714.827 842.176170@j33g 2000cwa.googleg roups.com>,
    electrician@ele ctrician.com wrote:
    [color=blue]
    > <There is no logcal need for goto.
    >
    > The lack of goto forces you to think of the correct way to solve your
    > problem, rather than relying on spaghetti code :)[color=green]
    > >[/color]
    >
    > So what about those of us that like programming in spaghetti code? Who
    > are you or the creators of JavaScript to force me to use their
    > programming concepts? I like Goto and want it and have worked for
    > hours to try something else when goto would have saved me precious
    > time. This is another example of academia forcing us to use useless
    > non productive time to preserve some higher than thou intellectual crap.[/color]

    You are a fathead, aren't you (as we saw in your other thread). The goto
    leads to unmaintainable spaghetti code, and as was pointed out in the
    other thread, it becomes untestable too, so you can't guarantee its
    gonna work properly in all conditions.

    FORTRAN has a goto, he says. Sure - and I stopped using FORTRASH in 1978
    - and that's also the last time I used a goto statement.

    You need to get it into your thick skull that this has nothing to do
    with "academia". It's called engineering. I want my software to:

    1) work
    2) be maintainable
    3) be extendable

    Spending some time making it properly structured and clean ("designing"
    it might be the pompous academic word to use here snoot snoot) will pay
    dividends down the road.

    I once spent several hours working through some "spaghetti" code only to
    find the klod had used a Fortran computed goto to implement subroutine
    calls. So several pages of code could suddenly be condensed into perhaps
    half a page. Buggered if I'm ever going to do THAT again.

    -- tim

    Comment

    • Tim Streater

      #17
      Re: Why doesn't JavaScript have a goto command?

      In article <dul989$ls4$1$8 302bc10@news.de mon.co.uk>,
      "Richard Cornford" <Richard@litote s.demon.co.uk> wrote:
      [color=blue]
      > electrician@ele ctrician.com wrote:[/color]
      [color=blue][color=green]
      > > I like Goto and want it and have worked for
      > > hours to try something else when goto would
      > > have saved me precious time.[/color]
      >
      > The odds are very good that whatever you are trying to do can be simply
      > done with the constructs javascript already has.[/color]

      Not just "very good", Richard. An odds-on certainty, a shoe-in, the only
      horse in the race with four legs, etc etc.

      -- tim

      Comment

      • Tim Streater

        #18
        Re: Why doesn't JavaScript have a goto command?

        In article <1141783701.288 081.140810@i39g 2000cwa.googleg roups.com>,
        electrician@ele ctrician.com wrote:

        [color=blue]
        > <<You will find that no new languages will have - goto -, because it
        > turned out to be a source of considerably more problems than it solved.[/color]
        [color=blue]
        > And I suppose Perl is not a Modern Language? Perl has a goto.
        > Furthermore, I really wonder how many of the "modern" JavaScript
        > programmers know iota about Fortran IV.[/color]

        I once (mid '70s) had to maintain a compiler written in FORTRAN by an
        "academic", and indeed to port it to another platform. This turned out
        to be quite easy because although he had used the goto (as FORTRAN IV
        lacks features), the author had been careful about it - no spaghetti. He
        had written it like an engineer would. So places where the FORTRAN
        dialects differed between the two machines were limited and clear. This
        exercise was at the end of a 10-year period writing in FORTRAN - I
        gratefully abandoned it as soon as better languages came on the scene.

        -- tim

        Comment

        • VK

          #19
          Re: Why doesn't JavaScript have a goto command?


          electrician@ele ctrician.com wrote:[color=blue]
          > So what about those of us that like programming in spaghetti code? Who
          > are you or the creators of JavaScript to force me to use their
          > programming concepts? I like Goto and want it and have worked for
          > hours to try something else when goto would have saved me precious
          > time. This is another example of academia forcing us to use useless
          > non productive time to preserve some higher than thou intellectual crap.[/color]

          <html>
          <head>
          <title>Test</title>
          <meta http-equiv="Content-Type"
          content="text/html; charset=iso-8859-1">
          <script type="text/javascript">
          function demo() {
          OUTER: while(true) {
          INNER: while(true) {
          var msg = 'Do I need to learn JavaScript better and go get some
          life?';
          var ans = window.prompt(m sg, 'Yes');
          if (ans.toLowerCas e() != 'yes') {continue INNER} else {break OUTER};
          }
          }
          }
          </script>
          </head>

          <body onload="demo()" >

          </body>
          </html>

          Comment

          • bgulian@gmail.com

            #20
            Re: Why doesn't JavaScript have a goto command?


            Matt Kruse wrote:[color=blue]
            > There is no logcal need for goto.
            >
            > The lack of goto forces you to think of the correct way to solve your
            > problem, rather than relying on spaghetti code :)[/color]

            Mostly true. Being fairly new to javascript, there may always be a
            better way than goto. In C++ however, we often run into this (pseudo
            javascript):

            for (i=0; i < limit; i++)
            {
            for (j=0;j < jlimit; j++)
            {
            //something goes wrong
            goto globalError;
            while (this_is_happen ing)
            {
            //something goes wrong
            goto globalError;
            }
            }
            //something goes wrong
            goto globalError
            }

            globalError:
            Something went wrong.


            Now, you could use exceptions to achieve the same thing but exceptions
            are painful in C++ as they may or may not get bubbled up to your
            handler. Are they better in javascript? Barring exceptions though,
            the abscence of goto means you must communicate the error to each level
            of the nested loop. Worse than spaghetti code, in my opinion.

            Bob Gulian

            Comment

            • Dr John Stockton

              #21
              Re: Why doesn't JavaScript have a goto command?

              JRS: In article <1141768123.959 774.259720@j52g 2000cwj.googleg roups.com>
              , dated Tue, 7 Mar 2006 13:48:44 remote, seen in
              news:comp.lang. javascript, Jonas Raoni <jonasraoni@gma il.com> posted :[color=blue]
              >Noozer wrote:[color=green]
              >> <electrician@el ectrician.com> wrote in message
              >> news:1141763263 .543682.253290@ i39g2000cwa.goo glegroups.com.. .
              >>[color=darkred]
              >>>Perl has it, Basic has it, Fortran has it. What is so difficult about
              >>>creating a goto command for JavaScript. Just set up a label and say go
              >>>to it.[/color]
              >>
              >> Because, if you need to use a GOTO, then you are doing something wrong.[/color]
              >
              >Not at all, sometimes you have to get out of two loops and with a goto
              >you can achieve this easily, goto is a reserved word, but JavaScript
              >has labels.
              >
              >while(confirm( "ok?"))
              > MyLabel:
              > while(1)
              > while(1)
              > break MyLabel;[/color]

              But I see no 'goto' there.

              When available, 'goto' always allows a jump from anywhere to anywhere
              remotely reasonable; but 'break label' is only for jumping out of [more
              than 1] enclosing loop. Those who write 'goto' do not mean 'break
              label'.


              --
              © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
              <URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
              <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
              <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

              Comment

              • Lasse Reichstein Nielsen

                #22
                Re: Why doesn't JavaScript have a goto command?

                "bgulian@gmail. com" <bgulian@gmail. com> writes:
                [color=blue]
                > Mostly true. Being fairly new to javascript, there may always be a
                > better way than goto. In C++ however, we often run into this (pseudo
                > javascript):
                >
                > for (i=0; i < limit; i++)
                > {
                > for (j=0;j < jlimit; j++)
                > {
                > //something goes wrong
                > goto globalError;
                > while (this_is_happen ing)
                > {
                > //something goes wrong
                > goto globalError;
                > }
                > }
                > //something goes wrong
                > goto globalError
                > }
                >
                > globalError:
                > Something went wrong.[/color]

                The better way in this case is a labeled break:

                outerloop:
                for (i=0; i < limit; i++) {
                for (j=0;j < jlimit; j++) {
                //something goes wrong
                break outerloop;
                while (this_is_happen ing)
                {
                //something goes wrong
                break outerloop;
                }
                }
                //something goes wrong
                break outerloop;
                }


                It uses nothing but the break feature, the general idiom for breaking
                out of a loop early. The label is only there to allow you to identify
                the loop to break out of if it is not the closes enclosing one, the
                break is the same.
                [color=blue]
                > Now, you could use exceptions to achieve the same thing but exceptions
                > are painful in C++ as they may or may not get bubbled up to your
                > handler.[/color]

                Don't know exceptions in C++.
                [color=blue]
                > Are they better in javascript?[/color]

                They are fairly simplistic in Javascript. There are no exceptions
                classes/types, so you can throw any value, and a catch catches
                all exceptions.
                [color=blue]
                > Barring exceptions though, the abscence of goto means you must
                > communicate the error to each level of the nested loop. Worse than
                > spaghetti code, in my opinion.[/color]

                I'm not sure where labeled break was first introduced. It existed in
                Ada, and is in most recent languages like Java, Javascript and C#.
                It's conceptually much nicer than the otherwise equivalent "goto
                label just after loop"

                /L
                --
                Lasse Reichstein Nielsen - lrn@hotpop.com
                DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                'Faith without judgement merely degrades the spirit divine.'

                Comment

                • Dr John Stockton

                  #23
                  Re: Why doesn't JavaScript have a goto command?

                  JRS: In article <1141833360.823 123.260320@z34g 2000cwc.googleg roups.com>
                  , dated Wed, 8 Mar 2006 07:56:00 remote, seen in
                  news:comp.lang. javascript, bgulian@gmail.c om <bgulian@gmail. com> posted
                  :
                  [color=blue]
                  > Being fairly new to javascript, there may always be a
                  >better way than goto. In C++ however, we often run into this (pseudo
                  >javascript):
                  >
                  >for (i=0; i < limit; i++)
                  >{
                  > for (j=0;j < jlimit; j++)
                  > {
                  > //something goes wrong
                  > goto globalError;
                  > while (this_is_happen ing)
                  > {
                  > //something goes wrong
                  > goto globalError;
                  > }
                  > }
                  > //something goes wrong
                  > goto globalError
                  >}
                  >
                  >globalError:
                  > Something went wrong.
                  >
                  >
                  >Now, you could use exceptions to achieve the same thing but exceptions
                  >are painful in C++ as they may or may not get bubbled up to your
                  >handler. Are they better in javascript? Barring exceptions though,
                  >the abscence of goto means you must communicate the error to each level
                  >of the nested loop. Worse than spaghetti code, in my opinion.[/color]

                  No "must" about it; put both loops in a function, return false for error
                  and true for success, and test that return result. You could, I expect,
                  upgrade your C that way too.

                  Perhaps there is or should be a Web page on obvious constructs and
                  appropriate codings.

                  --
                  © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
                  <URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
                  <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
                  <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

                  Comment

                  • Richard Cornford

                    #24
                    Re: Why doesn't JavaScript have a goto command?

                    electrician@ele ctrician.com wrote:[color=blue]
                    > Richard Cornford wrote:[color=green]
                    >> You should not be employed in commercial code development,
                    >> because you will be needlessly imposing ongoing costs on
                    >> anyone you work for.[/color]
                    >
                    > I work for myself.[/color]

                    You programming colleagues will be pleased to hear that ;)
                    [color=blue]
                    > If I had to hire elite JavaScript programmers
                    > that insist on not using goto I would be out of business.[/color]

                    Last week you were claming your business to be so successful that you
                    didn't need to worry about supporting more than default configurations
                    of one browser, this week it is so marginal that you cannot afford to
                    employ people who have the skill you perceive as necessary (i.e. the
                    ability to write javascript).
                    [color=blue]
                    > Yet several of my JavaScript programs are practical and
                    > solve very complicated linear programming models in the
                    > electrical field where I am an expert.[/color]

                    I assume that is "solve" in the sense of 'behave as expected when
                    minimally tested with acceptable inputs', given how easily RobG found
                    bugs with non-expected input.

                    One thing that is certain is that your programs will die with you,
                    because anyone seeing your spaghetti code is likely to prefer to
                    re-write from scratch rather than commit themselves to the burden of
                    attempting ongoing maintenance (unless you can find someone particularly
                    masochistic, or who doesn't know any better themselves).
                    [color=blue]
                    > I want a goto statement, because it would make my programming
                    > life easier.[/color]

                    Only in he sense that it would allow you to carry on 'programming'
                    without learning to do without goto. But learning to program without
                    goto is what would actually make your programming life easier. And I say
                    that as someone who first learnt programming in the days when BASIC had
                    a number for every line and goto was virtually the only way of jumping
                    about in a program. I stopped using goto in BASIC with the first version
                    that had subroutines and found the results considerably easier to code
                    and maintain.

                    I quite liked the mental challenge of trying to maintain a consistent
                    mental model of code written in early BASIC. The more complex the code
                    gets the bigger the challenge, but the unfortunate reality is that the
                    human capacity to comprehend complexity is limited and once you go
                    beyond 2,000 - 4,000 statements the ability to perceive the whole system
                    in code terms is exceeded, and spaghetti code just degenerates into an
                    unmanageable mess, getting more chaotic with every addition.

                    It is dealing with the limited human ability to comprehend complexity
                    that has forced programming languages to evolve, and they have evolved
                    in a way reduces large interdependent programs into autonomous units
                    that are simple enough to comprehend (and vigorously test) in isolation,
                    and shifts the challenge of comprehending the system up a level (or two)
                    to the interactions between those now abstracted units.

                    The intellectual challenge of comprehending 2000 lines of spaghetti
                    BASIC filled with goto statements transforms into the challenge of
                    comprehending the architectural and design aspects of the
                    interrelationsh ips between a few hundreds of objects implemented with
                    60,000 lines of code. And is, in the end, a more rewarding application
                    of the intellect and orders of magnitude more productive.

                    The strategies that make the big, complex, systems manageable make the
                    smaller programs, that can be implemented in 2000 odd lines of code,
                    relatively simple. And that is what makes your programming life easier
                    in the long run.
                    [color=blue]
                    > I like to spend my time on subject issues, not programming
                    > issues.[/color]

                    You are unlikely to appreciate how much time you have wasted on
                    modifying/maintaining spaghetti code until you have learnt to write
                    non-spaghetti code (as you will not get to work on code written by
                    others while you work for yourself and will not employ real
                    programmers), so you are not really in a position to judge what
                    proportion of their time is spent on "subject issues" rather than
                    programming issues by professional programmers.
                    [color=blue][color=green]
                    >> <How can anyone be forcing you to write javascript at all?
                    >> But if you choose to (for reasons of expedience or whatever)
                    >> it makes more sense to learn to use the language as it is
                    >> rather than wishing it was another throwback to the 1960s.[/color]
                    >
                    > I used the older languges quite efficiently before JavaScript
                    > came along,[/color]

                    Where is your benchmark for "quite efficiently"? You have not been
                    working alongside other programmers so how do you know that what your
                    perceive as efficient is not horribly inefficient by comparison?
                    [color=blue]
                    > and I often used goto.
                    > I really do think I will be looking at Visual Basic Script.
                    > If it has a goto I may just goto vbscript and give MS even
                    > further credit for out doing Sun.[/color]

                    If that is what you want to do, do so. It would be solving the wrong
                    problem but if you insist upon fixating on an imagined need to use goto
                    you won't make any more progress with javascript.
                    [color=blue][color=green][color=darkred]
                    >>> I like Goto and want it and have worked for
                    >>> hours to try something else when goto would
                    >>> have saved me precious time.[/color][/color]
                    >[color=green]
                    >> The odds are very good that whatever you are trying
                    >> to do can be simply done with the constructs javascript
                    >> already has.[/color]
                    >
                    > No way![/color]

                    No way? Are you saying that it is impossible to program without goto?
                    That would mean that all of that code written in Java, javascript and a
                    host of other recent languages (not to mention older languages that
                    retain goto but where it would never be used by competent programmers)
                    doesn't actually work. I think someone would have noticed that by now
                    and said something.
                    [color=blue]
                    > Fortran still has goto and has for longer than most
                    > JavaScript programmers have been alive.[/color]

                    The vast majority of javascript programmers are older than the language
                    is, many will be younger than Fortran. But a programming language being
                    old is not in itself a good thing, lessons have been learnt from what
                    has gone before, and one of the drawbacks of the older languages that
                    have been updated is that they tend to retain features for no reason
                    other than backwards compatibility, while new languages get to ditch the
                    dross entirely.
                    [color=blue][color=green][color=darkred]
                    >>> This is another example of academia forcing us to use
                    >>> useless non productive time to preserve some higher than
                    >>> thou intellectual crap.[/color][/color]
                    >[color=green]
                    >> You will find that no new languages will have - goto -,
                    >> because it turned out to be a source of considerably more
                    >> problems than it solved.[/color]
                    >[color=green]
                    >> Recognising when something is a bad idea and stopping doing it
                    >> is not only the preserve of academia. But you are the one
                    >> wasting time railing against the way things are instead of
                    >> learning to cope. That is not very practical of you.[/color][/color]
                    <snip>[color=blue]
                    >
                    > And I suppose Perl is not a Modern Language?[/color]

                    No not really, but I said "new languages" anyway.
                    [color=blue]
                    > Perl has a goto.[/color]

                    C++ has goto as well, though you wouldn't expect to see it being used
                    often, if at all.
                    [color=blue]
                    > Furthermore, I really wonder how many of the "modern"
                    > JavaScript programmers know iota about Fortran IV.[/color]

                    I very much doubt that any 'modern' javascript programmers know how to
                    set the switches and wire the plugs on an ENIAC, but I don't anticipate
                    any of them suffering for the lack of that 'skill'.

                    Richard.


                    Comment

                    • Randy Webb

                      #25
                      Re: Why doesn't JavaScript have a goto command?

                      Dr John Stockton said the following on 3/8/2006 5:04 PM:
                      [color=blue]
                      >
                      > Perhaps there is or should be a Web page on obvious constructs and
                      > appropriate codings.[/color]

                      There are. Below are at least two of them.

                      --
                      Randy
                      comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
                      Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

                      Comment

                      • sam.partington@gmail.com

                        #26
                        Re: Why doesn't JavaScript have a goto command?

                        bgulian@gmail.c om wrote:
                        (snip)[color=blue]
                        > for (i=0; i < limit; i++)
                        > {
                        > for (j=0;j < jlimit; j++)
                        > {
                        > //something goes wrong
                        > goto globalError;
                        > while (this_is_happen ing)
                        > {
                        > //something goes wrong
                        > goto globalError;
                        > }
                        > }
                        > //something goes wrong
                        > goto globalError
                        > }
                        >
                        > globalError:
                        > Something went wrong.
                        >
                        >
                        > Now, you could use exceptions to achieve the same thing but exceptions
                        > are painful in C++ as they may or may not get bubbled up to your
                        > handler. Are they better in javascript? Barring exceptions though,
                        > the abscence of goto means you must communicate the error to each level
                        > of the nested loop. Worse than spaghetti code, in my opinion.[/color]
                        (snip)

                        No! Absolutely no! This is absolutely the wrong way to do this in C++
                        or javascript.

                        Exceptions are not painful in C++, there is no "may or may not" get
                        bubbled. They WILL propagate. The above code is even less appropiate
                        in C++ than it is in javascript.

                        I can think of several ways to solve the above problem :

                        1. Use exceptions - this is the best way.

                        2. Break down the complex three level loops into smaller well defined
                        functions, or use algorithms.

                        3. If you absolutely can't use exceptions add an error condition into
                        the loop condition expression -- its not that hard, and its a lot
                        clearer in intent *.

                        4. If you are using error codes you can even return a failure error
                        code in the inner loop. In javascript any resources will be cleaned up
                        by garbage collection, in C++ your destructors will handle it.

                        Seriously, if you're writing C++ code like this you need to read up on
                        some modern C++ style. Try effective C++ by Scott Mayers for starters.

                        Sam

                        Comment

                        • bgulian@gmail.com

                          #27
                          Re: Why doesn't JavaScript have a goto command?


                          sam.partington@ gmail.com wrote:[color=blue]
                          >
                          > No! Absolutely no! This is absolutely the wrong way to do this in C++
                          > or javascript...[/color]

                          Thanks to LRN for furthuring a constructive discussion with real code
                          and an elegant way to solve the problem I stated. Thanks to the rest
                          of you for the grandstanding, ego polishing, and the usual entertaining
                          stuff that once in a while imparts some great knowledge. You actually
                          made me have some sympathy for the spaghetti coding electician.
                          [color=blue]
                          >Seriously, if you're writing C++ code like this you need to read up on
                          >some modern C++ style.[/color]

                          I exampled a code construct that have encountered many times in my code
                          and other people's code. I am trying to find a way that is better. LRN
                          gave me one.

                          Bob Gulian

                          Comment

                          • sam.partington@gmail.com

                            #28
                            Re: Why doesn't JavaScript have a goto command?

                            bgulian@gmail.c om wrote:[color=blue][color=green]
                            > >Seriously, if you're writing C++ code like this you need to read up on
                            > >some modern C++ style.[/color]
                            >
                            > I exampled a code construct that have encountered many times in my code
                            > and other people's code. I am trying to find a way that is better. LRN
                            > gave me one.[/color]

                            Look sorry, I didn't want to start a flame war, the thing that annoyed
                            me was the comment about C++ exceptions being buggy, which is simply
                            not true, and you made no effort to back up the statement with a
                            reference or examples.

                            This has all been covered before, for every new language that comes
                            along, PHP for example :



                            In fact is has become satirical in its use :

                            goto for Python: adds the 'goto' and 'comefrom' keywords to Python. An April Fool's joke that works.


                            Its not just an academical holier-than-thou thing, its a prejudice that
                            has been built up by developers in lots of languages after years of
                            experience of debugging and maitaining complicated code.

                            I did offer 4 alternatives to your posted code, here are two of them
                            spelt out of course they are a bit artificial. The benefits of the
                            exceptions method being :

                            - You can't ignore the error.
                            - You don't need to litter all your functions with return codes.
                            - Errors can propagate from the lowest level small helper functions
                            right up to the caller who can do something useful with the error.
                            - The caller can decide at what level to handle the error.
                            - The larger the app, the more beneficial using exceptions becomes.

                            1.
                            try
                            {
                            for (i=0; i < limit; i++)
                            {
                            for (j=0;j < jlimit; j++)
                            {
                            //something goes wrong
                            throw err_code_1;
                            while (this_is_happen ing)
                            {
                            //something goes wrong
                            throw err_code_2;
                            }
                            }
                            //something goes wrong
                            throw err_code_3;
                            }
                            }
                            catch (err)
                            {
                            document.write( "An Error Occurred: " + err);
                            }

                            (or better yet, let the error propagate to the caller, who can
                            probably do something more useful)


                            2.
                            function do_it()
                            {
                            for (i=0; i < limit; i++)
                            {
                            for (j=0;j < jlimit; j++)
                            {
                            //something goes wrong
                            return err_code_1;
                            while (this_is_happen ing)
                            {
                            //something goes wrong
                            return err_code_2;
                            }
                            }
                            //something goes wrong
                            return err_code_3;
                            }
                            return 0;
                            }

                            var err = do_it();
                            if (err)
                            {
                            // whatever
                            }

                            Comment

                            • Tim Streater

                              #29
                              Re: Why doesn't JavaScript have a goto command?

                              In article <1141918542.646 597.173620@z34g 2000cwc.googleg roups.com>,
                              sam.partington@ gmail.com wrote:
                              [color=blue]
                              > bgulian@gmail.c om wrote:[color=green][color=darkred]
                              > > >Seriously, if you're writing C++ code like this you need to read up on
                              > > >some modern C++ style.[/color]
                              > >
                              > > I exampled a code construct that have encountered many times in my code
                              > > and other people's code. I am trying to find a way that is better. LRN
                              > > gave me one.[/color]
                              >
                              > Look sorry, I didn't want to start a flame war, the thing that annoyed
                              > me was the comment about C++ exceptions being buggy, which is simply
                              > not true, and you made no effort to back up the statement with a
                              > reference or examples.
                              >
                              > This has all been covered before, for every new language that comes
                              > along, PHP for example :
                              >
                              > http://www.procata.com/blog/archives...9/goto-in-php/
                              >
                              > In fact is has become satirical in its use :
                              >
                              > http://www.entrian.com/goto/
                              >
                              > Its not just an academical holier-than-thou thing, its a prejudice that
                              > has been built up by developers in lots of languages after years of
                              > experience of debugging and maitaining complicated code.[/color]

                              [...]

                              Of course its also true that I can write FORTRAN in any language. By
                              which I mean that any language can be abused and have spaghetti written
                              in it, goto or not.

                              I suspect Mr Electrician would complain more about Pascal even though it
                              has goto, than other languages. The fact it didn't have a return
                              statement made me abandon it very quickly. In the end I just put a dummy
                              statement with label 999 at the end of every procedure and goto'ed there
                              when I needed to return.

                              -- tim

                              Comment

                              • VK

                                #30
                                Re: Why doesn't JavaScript have a goto command?


                                Tim Streater wrote:[color=blue]
                                > I suspect Mr Electrician would complain more about Pascal even though it
                                > has goto, than other languages. The fact it didn't have a return
                                > statement made me abandon it very quickly. In the end I just put a dummy
                                > statement with label 999 at the end of every procedure and goto'ed there
                                > when I needed to return.[/color]

                                I say Sinclair Basic on ZX Spectrum rules - after all this time! GBasic
                                was not so bad neither - but nothing close to the first one. Starting
                                with QBasic things started to go to the OOP Hell - and there they are
                                now :-(

                                :-D

                                Comment

                                Working...