Friday, July 10th, 2009

GOTO is here

Category: Fun

Ah GOTO. Now life is complete. How could one enjoy a Fun Friday better than looking at a goto implementation in JavaScript:

  1. <script type="text/jsplusgoto">
  2. var a = 0;
  3. [lbl] topOfLoop:
  4. a++;
  5. if (a < 292 ) {
  6.    goto topOfLoop;
  7. }
  8. document.getElementById('relevantLink').setAttribute('href', 'http://www.xkcd.com/' + a);
  9. </script>

Note the “text/jsplusgoto” in there. The nice simple parseScripts abstraction is used to find that code, munge it to JavaScript, and then run it.

Posted by Dion Almaer at 6:18 am
14 Comments

+++--
3.3 rating from 55 votes

14 Comments »

Comments feed TrackBack URI

Kill it. Kill it with fire.

Comment by mdmadph — July 10, 2009

[lbl] 1964;
goto 1964;

Comment by kanduvisla — July 10, 2009

only something this terrible could make me register. I pray to god that whoever made this, got hit by a bus today.

Comment by Tol — July 10, 2009

The interesting thing there is parseScripts — what a cool way to add features to JS!

But, please, no “goto”. ;)

Comment by andysky — July 10, 2009

Let’s not GOTO there, people.

Comment by andysky — July 10, 2009

You can hide the raptor with CSS, but you can’t fool me.

Comment by randomrandom — July 10, 2009

It is actually useful in some languages (I have found uses for it in C#), but not Javascript.

Comment by Darkimmortal — July 10, 2009

Wtf is [lbl] for? JavaScript has native support for labels and you don’t need to precede them with [lbl].

Comment by EliGrey — July 10, 2009

Is this a joke? ….. I checked my calendar, and it’s not April 1.

Comment by mjuhl — July 10, 2009

Some people need to actually read the article and related blog post. Why do some people only read the headline and go from there?

The guy actually states that this is a joke.

The whole thing reads as a joke even before the guy admits it. No one understood when he says he doesn’t condone the use of functions? Functions are for the weak?

Come on people.

Comment by travisalmand — July 10, 2009

@travisalmand

This is the internet. The internet is made up of 50% people with acerbic wit and biting sarcasm, and 50% people who believe everything they read.

Just the fact that someone could read this and think it’s a good idea is dangerous enough.

Comment by mdmadph — July 10, 2009

Too bad parseScripts doesn’t actually parse scripts into anything other than a big blob.

Comment by eyelidlessness — July 10, 2009

Clearly this only makes sense. Since PHP got that operator now, there needs to be a unified programming model on the server and on the client. I hope this ist part of ECMAScript soon.

Comment by BonoboBoner — July 11, 2009

… this won’t end well!

Comment by hdragomir — July 12, 2009

Leave a comment

You must be logged in to post a comment.