You programming colleagues will be pleased to hear that
If I had to hire elite JavaScript programmers
that insist on not using goto I would be out of business.
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).
Yet several of my JavaScript programs are practical and
solve very complicated linear programming models in the
electrical field where I am an expert.
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).
I want a goto statement, because it would make my programming
life easier.
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
interrelationships 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.
I like to spend my time on subject issues, not programming
issues.
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.
I used the older languges quite efficiently before JavaScript
came along,
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?
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.
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.
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.
Fortran still has goto and has for longer than most
JavaScript programmers have been alive.
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.
And I suppose Perl is not a Modern Language?
No not really, but I said "new languages" anyway.
C++ has goto as well, though you wouldn't expect to see it being used
often, if at all.
Furthermore, I really wonder how many of the "modern"
JavaScript programmers know iota about Fortran IV.
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.