- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
In hetergenous world of browsers and javascript, the variants are maddening. I can see loading the sample page in a bunch of different browsers just to make sure you are building on a known foundation.
It probably took this guy a few minutes to write the tests. It may have saved hours of frustration with some crazy browser that a customer just must use.
I was almost burned a few times with vendor (binary) libraries.
We had a small issue with a J2EE container at version x.x.x.6. Basic API behaviors changed dramatically between that version and ...7, ...8, ...9 until things settled down around x.x.x.10.
Of course by that time we had written our own layer to sit atop the changing parts of the vendor's J2EE layer to ensure consistent behavior. The J2EE spec did not cover some of these areas in enough detail to ensure a deterministic behavior, but this is supposedly a sub-sub-patch level. I would have expected changes like this at x.y.0.0 or y.0.0.0 but not big changes for a sub-sub patch.
My guess is that they had 2 different clients battling for releases with different interpretations of the spec.
The 2 big ones I remember were
Admin
QFT. Subsequent posts have proven that JavaScript compilers exist, but have not refuted the fact that they are in fact a BIG WTF.
Admin
On JS as a modern scripting language: JavaScript is compiled to speed code just in time with lazy variable resolving. (P.E.: If you've a look at the Rhino code, tokens are converted to integer codes; All modern JS engines are making use of code optimization. Maybe it's the principle of fail-as-late-as-possible that let's you take it for a straight interpreted language?)
The TWTF: If this code is meant to test the implementation of .contains() and .indexOf() there's quite some extra prose, since the JS engine would just fail at compile time as ist hits the first useage of these methods in the code.
If you would want to check the availability of native functions you'ld do some as the following:
(Akismet: No I'm not a bot trying to submit evil code.)
Admin
I agree.
High horse anyone?
Admin
Really? From ECMA 262 2nd ed. (Aug. 1998):
So there's a clear definition of progressive steps of lexical analysis, compilation, and runtime even in the 90s (Netscape 4 & co).
Admin
With JS in heavier use these days (FaceBook, for example), compilers for JS actually are in demand. Ever had your machine bogged down by all that live updating? I have.
Admin
Palm Pre's SDK is mostly JavaScript, or was before they caved into pressure.
Even their text messaging handler was written in JS.
Admin
The MongoDB Shell uses a built-in Javascript interpreter to query the database. This is a stand-alone application.
Admin
You need to ask for a refund of your tuition.
There is no such thing as a compiled language or an interpreted language. You can interpret C just as you can compile bash. The language itself may make one more useful than the other, but there's no intrinsic property of the language forcing you to do that.
And while many Javascript implementations are still interpreters, modern implementations are moving towards just-in-time compilers, that is they are hybrid interpreter / compilers that generate native machine code for frequently executed code. Examples: Firefox's TraceMonkey (named after its technique for JIT), Chrome's v8 (from the description, more of a straight compiler than a JIT hybrid).
In the past, a common technique was to generate C code, now more people are moving towards LLVM.
Admin
Javascript (ECMA Script standard) objects use a prototype rather than superclass based inheritance. This does not lend itself to compiled programs.
Other languages, like Smalltalk and Python, also allow classes to change over the program's life-cycle. All such languages, I believe, must be interpreted.
Admin
this gives me a bonar
Admin
It's also possible to use mixed mode systems that start by interpreting and switch in the compiled version once it's done (compilation being done in a separate thread). That's very good indeed, but much more complex. Simple JITting is typically good enough.
Admin
Similarly, any code that can be compiled can also be interpreted. CINT - interpreted C
Not that I'd want to, but it is possible.
Admin
I had a good snicker when I saw this:
The best part is that it is extensible (confusingly so, to boot):
...and etc.
Admin
Admin
V8 has been pointed out already, but I'll add some more:
Admin
Why not call it Academy for Advancement of Amazing and Ridiculous Gargabe (AAARGH) ?
Admin
Admin
WINNER! (That'll teach anyone to think twice before calling JS a WTF)
Admin
JS is definitely a WTF. It's even worse than VB!
Admin
A rather mediocre WTF that was utterly saved by misguided comments about JavaScript compilation. Well done that man, I'm still chuckling at the thought.
Admin
Once again evidence abounds that the vast majority of TDWTF submitters and users are more clueless about programming than their 'victims'. The comments on this story are way more entertaining than the main article, which isn't actually a WTF at all.
Oh, and The Nerve, please don't stop posting! Have you got a blog? If not, you definately need one, I'd looooove to have somewhere I could keep up to date with your insightful thoughts about programming, and I'm sure I'm not alone!
Admin
Addendum (2010-07-22 09:16): Addendum: Testing a.contains(new Object()) most definitely is a WTF as it can never be true. Type: var X = new Object();[X, 3].indexOf(new Object()) into Firebug and notice you get -1 (which means .contains, if implemented, returns false).
Admin
I certainly there's a <noscript> fail-safe on the HTML page!
Admin
It clearly would be a broken implementation, but the whole point of these tests is to check if there are errors in the Javascript implementation!
CAPTCHA: ludus A script language for playing around.
Admin
Whether it's compiled or not, Javascript is still TRWTF.
Admin
Don't be so rude. The Nerve is probably working with Microsoft, veteran JScript developer! (This would at least explain some issues with IE3.)
Admin
Admin
JScript!!! Now there's TRWTF.
Admin
Admin
Simple, if you cripple the language by removing some of its most defining features, keeping most of the name but little of the spirit...
Admin
Hopefully you only write tests and not code.
Admin
You should take a look at Node.JS, Appcelerator Titanium, Adobe AIR and JSDB. Lots of psychs out there.
Admin
That would be actually required in strict mode according to the ECMAScript Harmony spec.
Admin
Sadly, it doesn't even take a college student to google before posting stupid stuff.