Gene Wirchenko wrote on 27 dec 2011 in comp.lang.javascript:
Are you unable to counter this case?
Your taste about this man is not an issue here, the issue is his sound
explanation of his ideas.
I do not consider that insulting people as mentally mutilated as
he did in the quote following is sound.
Yes quite. BASIC should be understood as the BASIC of thatr time,
not the Visual Basic and its predessesors of young William Gates
that incorporated Dijkstra's ideas from Algol-60 etc.
Perhaps you do not know the level of BASIC at that time,
where only this existed:
And perhaps I know exactly what the BASICs of the time were like.
I do; I used them.
IF boolean GOTO
and not yet:
IF boolean THEN
Actually, quite often the syntax was
IF <expression> THEN <lineno>
where said:
And that corrupted a generation of programmmers for the idea of
"nesting", what we now call modular programing.
Oh, nonsense! When I then ran into other languages, I picked up
their features quickly enough.
You first prove yours, I askesd first,
you talk about "Some algorithms are more easily expressed with a goto".
I have already given an example. You are making the
extraordinary claim. How about you prove yours?
Why should I prove my rebuttal to this unsubstaniated sentence?
I have already given the relevant detail in the following
paragraph.
What nonsense, recursive programming can just as well be done in a
modular way.
I was not referring to the recursion, but to one level of
sorting. Quick sort has a pointer that starts from one end and
another that starts from the other. With the pair of goto statements,
the symmetry is readily apparent.
It seems you also are bitten by the goto-bug. Are you that old?
No, I am not bitten by it. I simply refuse to totally demonise
goto statements. I do not use goto statements but rarely, but
sometimes, they are acceptable.
At 51, probably.
If so, it proves my point NOT to teach new programmers the idea of GOTO
in any language higher than chip microcode or assembler.
It seems you to do not know what that means.
Since I have written a number of state machines, I do know what
it means.
The computer is a state m-machine by itself,
governed by a central state stepping clock.
Oh, I know, but Mr. Michna and I are referring to something else:
applications that have state machines.
There is nore reason to duplicate that, except for teaching purposes.
A compiler typically uses state machines. I use state machines
in certain validation routines for a client billing app I support.
There are plenty of other examples. Try writing a calculator program
without using a state machine.
Even then there is no necessary or even useful reason to use a goto
there.
I have found it useful.
But please if you must, show us an example where the goto statement is a
necessary or just usefull statement to use [INSIDE Javascript, this is a
JS NG]
Probably less necessary since JavaScript code is typically not
very long and not very time-sensitive.
Methinks your would-be pupils will just be set on the wrong foot,
and they won't like you for it if they screw up on modular thinking.
Actually, I have successfully taught people programming. I would
not make the mistake of telling them that goto statements are pure
evil. I would tell them why it is not a good idea, in general, to use
them and where they might, might use them to good advantage. I would
also note that it is probably less often than they think.
No, no, no.
Than you loose the concept of modularity, corrupting inner return
ppoiners in the process. Modern compilers will revover from this, but
with time consuming internal correction code ...
In many languages, those blocks are now out of scope and their
variables will be tossed.
.. or hopefully by optimalisation, in fact throwing your GOTO out in an
attempt to restore modularity.
I might not. Break statements are just the means of goto-adepts to
suppress their goto-world-view to a pseudo-modular world.
I do prefer the use of control variables. The client billing app
I just referred to has none -- I just checked -- but I do not consider
that my view rules over all.
The other day I expressed my disgust for switch statement,
and I remember you concurred.
I do not like switch because of bad syntax (just plain bad and
because it breeds errors) and semantic limitations.
Show me that case, if you can!
Do some reading on your own. When one is extremely constrained
in what one is programming, some of the usual practices get tossed. I
have read of programmers describing how they had to fit their code in
2048 bytes and no more. To do such things, they would load opcodes to
do arithmetic, because the particular opcode had the right value.
Yes, very unreadable code, but too long of code, in that case,
was so wrong that it would not run.
There is no such case in optimizing compilers,
but more to the point, there is not GOTO in javascript.
The goto statement in JavaScript is continue.
Implementing such GOTO, as was tried in this thread, will sacrifize any
even unfounded idea of speed gain.
Maybe. If it really mattered on the time issue, I would
benchmark it.
Sincerely,
Gene Wirchenko