473,765 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why doesn't JavaScript have a goto command?

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.

Mar 7 '06
34 26645
el*********@ele ctrician.com wrote:
Matt Kruse wrote:
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 :)


So what about those of us that like programming in spaghetti
code?


You should not be employed in commercial code development, because you
will be needlessly imposing ongoing costs on anyone you work for.
Who are you or the creators of JavaScript to force me to
use their programming concepts?
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.
I like Goto and want it and have worked for
hours to try something else when goto would
have saved me precious time.
The odds are very good that whatever you are trying to do can be simply
done with the constructs javascript already has.
This is another example of academia forcing us to use
useless non productive time to preserve some higher than
thou intellectual crap.


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.
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.

Richard.
Mar 8 '06 #11
Lee wrote:
Tony said:
Noozer wrote:
<el********* @electrician.co m> wrote in message
news:11***** *************** **@i39g2000cwa. googlegroups.co m...
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.
Because, if you need to use a GOTO, then you are doing something wrong.


Ever program in Assembly?

These days, I think it qualifies as "doing something wrong".


lol
Mar 8 '06 #12
<<You should not be employed in commercial code development, because
you
will be needlessly imposing ongoing costs on anyone you work for. >>

I work for myself. If I had to hire elite JavaScript programmers that
insist on not using goto I would be out of business.
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 want a goto statement, because it would make my programming life
easier. I like to spend my time on subject issues, not programming
issues.

<<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.>>

I used the older languges quite efficiently before JavaScript came
along, 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.

I like Goto and want it and have worked for
hours to try something else when goto would
have saved me precious time.

<<The odds are very good that whatever you are trying to do can be
simply
done with the constructs javascript already has.>>

No way! Fortran still has goto and has for longer than most JavaScript
programmers have been alive.
This is another example of academia forcing us to use
useless non productive time to preserve some higher than
thou intellectual crap.

<<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.

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.
Richard. >>

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.

Mar 8 '06 #13
Zif
el*********@ele ctrician.com wrote:
<<You should not be employed in commercial code development, because
you
will be needlessly imposing ongoing costs on anyone you work for. >>

I work for myself. If I had to hire elite JavaScript programmers that
insist on not using goto I would be out of business.
Insisting on using a language feature that doesn't exist may have made
it difficult to hire any programmer, much less an 'elite'.

Yet several of my JavaScript programs are practical and solve very
complicated linear programming models in the electrical field where I
am an expert.
But your programs have bugs, how practical is that?

I want a goto statement, because it would make my programming life
easier. I like to spend my time on subject issues, not programming
issues.
Obviously you have little time for programming. You don't have time to
fix obvious bugs in your programs and you don't bother to program for
any browser other than IE.

<<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.>>

I used the older languges quite efficiently before JavaScript came
along, and I often used goto.
I really do think I will be looking at Visual Basic Script.
Please do - your pages only work in IE anyway. Your programs contain
bugs and errors, the more their distribution is restricted the better.

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.
Sun? They own the JavaScript trademark, their involvement in the
development of JavaScript has been minimal. Or are you getting confused
with Java? Java doesn't have goto either.
[...]
<<The odds are very good that whatever you are trying to do can be
simply
done with the constructs javascript already has.>>

No way! Fortran still has goto and has for longer than most JavaScript
programmers have been alive.
FORTRAN must keep goto for backwards compatibility, the fact that it
continues in the language does not indicate that it is essential for all
programming languages.

Here's an article written in 1968 titled "Go To Statement Considered
Harmful":

<URL:http://www.acm.org/classics/oct95/>

About the author:
<URL:http://www.cs.utexas.e du/~EWD/>

[...]
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.


You have previously said that you don't need to learn anything about
standards or design principles to write JavaScript programs, why should
your opinion on any programming subject be taken seriously?

Perl was first released (version 1.0) in 1987, so it is almost as old as
Windows. FORTRAN IV was released in 1966. Is the age of an idea the
sole criterion for whether it is better than some other idea?

Has there never been a new idea that was better than an old idea? Maybe
Newton saw further because while standing on the shoulders of giants he
kept his eyes shut tight.

--
Zif
Mar 8 '06 #14
I work for myself. If I had to hire elite JavaScript programmers that
insist on not using goto I would be out of business.
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 want a goto statement, because it would make my programming life
easier. I like to spend my time on subject issues, not programming
issues.
Ive just got to chime in here. Im also a self taught programmer (for
the past 12 years), and I also used to be an electrician (which turned
out to be a huge benefit when it comes to debugging and QA, by the
way).

At first I had no small amount of sympathy for you, in the calculator
thread; you ran head first into a bunch of egos. But now you come back
for more, and Im not sure why you expected anything different, unless
thats what youre looking for...

The thing is, a programming language is just a tool like any other; a
hammer, an EMT/Rigid bender, the law, a fork, spoken languages, shoe
horns...all tools. Which tool you use and how you use it depends on
what it is you want to do.

As was allready pointed out, goto is not used much anymore because of
the problems that arise when it is abused. I know you work relatively
alone and run a small site, but the reality is its not with programmers
like you in mind that language features are decided upon. The vast
majority of software is developed by groups and teams of developers,
many of whom never see each other, so features that tend to be abused
and thus make a language unreadable by anyone coming along later
usually get frowned upon. With the advent of the web, scalability is
also a huge concern; your app may run fine on the desktop with one
user, but collapse when 200k people all access it at once.

Havent you ever gone into a panel and wondered "What the hell was this
moron doing? Its going to take me forever to straighten this out" as
you look at the 220 feeds and dont see brown yellow or orange anywhere?
Kinda like that. Doesnt it piss you off when the guys who did the new
construction obviously didnt give a rats ass about the guys who had to
come along and make repairs/maintain things later on? (Can you say
Union Labor?)

If you had to run, oh, half inch EMT from one side of a room to
another, the walls being 10 feet apart - you cant go accross, only
around - that means two 90s...do you also complain that you have to put
a box in between? I mean, its only 20 feet, what a waste of your time,
right? But there are reasons ~why~ you have to put a box between, arent
there? What would you say to an impatient helper who said screw it and
bent and strapped the run with no box in the middle? (Id say YOU pull
the damn wire, then make him rip it out and put in the box). Also to
the point, why are you supposed to put a loop in the wire in the box?
Is it so you can do your job faster, or is it so the guys who open it
up later on can do theirs safer?

My long winded point is that there are many many priorities being
balanced in the evolution of any programming language. Its not all
about initial dev time, its about future maintenance time, scalability,
learning curve, etc etc etc. And languages ~do~ evolve; goto is just
proving to be unfit for survival. Personally I hate it with a passion,
but then Ive spent a lot of time in the past as a maintenance
programmer. ;) Its dissappearance is just Darwinism as far as Im
concerned.
This is another example of academia forcing us to use
useless non productive time to preserve some higher than
thou intellectual crap.


While Im not going to argue with you that those ducks are in the sky
oftentimes, in this case I think youre shooting the old man standing
next to you with a hellava lot of salt shot. Dont let youre anger at
the pomposity, self importance and pretension you find here prompt you
to write code that in the future may bite you in the ass.

Eric

Mar 8 '06 #15
In article <11************ **********@j33g 2000cwa.googleg roups.com>,
el*********@ele ctrician.com wrote:
<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 :)


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.


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
Mar 8 '06 #16
In article <du************ *******@news.de mon.co.uk>,
"Richard Cornford" <Ri*****@litote s.demon.co.uk> wrote:
el*********@ele ctrician.com wrote:

I like Goto and want it and have worked for
hours to try something else when goto would
have saved me precious time.


The odds are very good that whatever you are trying to do can be simply
done with the constructs javascript already has.


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

-- tim
Mar 8 '06 #17
In article <11************ **********@i39g 2000cwa.googleg roups.com>,
el*********@ele ctrician.com wrote:

<<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. 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.


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
Mar 8 '06 #18
VK

el*********@ele ctrician.com wrote:
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.


<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>

Mar 8 '06 #19

Matt Kruse wrote:
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 :)


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

Mar 8 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
13387
by: WindAndWaves | last post by:
Can anyone tell me what is wrong with the goto command. I noticed it is one of those NEVER USE. I can understand that it may lead to confusing code, but I often use it like this: is this wrong????? Function x select case z
0
9566
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9393
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10153
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9946
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7371
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5272
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2800
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.