Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

Should JavaScript Get More Respect?

Posted by kdawson on Wed Dec 20, 2006 04:39 AM
from the ugly-duckling dept.
An anonymous reader points out an article in IBM's Crossing Borders series about the language features of JavaScript, surely the Rodney Dangerfield of scripting languages. But with increasing use in such technologies as Ajax, Apache Cocoon, ActionScript, and Rhino, some industry leaders are taking a fresh look at the language. From the article: "Nearly every Web developer has cursed JavaScript at one time or another. Until recently, many developers had all but written off JavaScript as a necessary evil at best or a toy at worst... But JavaScript is becoming increasingly important, and it remains the most broadly available scripting language for Web development."
+ -
story
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • JS (Score:5, Interesting)

    by djupedal (584558) on Wednesday December 20 2006, @04:42AM (#17310402)
    it remains the most broadly available scripting language for Web development.

    As someone who has written applets with over 25,000 lines, I can easily agree. Out of the roughly two dozen languages (scripting, etc.) that I know, JS has been a cornerstone of both simple and solid applets and the quick & dirty prototype. Let's hope the future agrees :)
    • Re:JS (Score:4, Insightful)

      by Schraegstrichpunkt (931443) on Wednesday December 20 2006, @04:47AM (#17310440) Homepage
      And yet you don't seem to know the difference between an embedded Java applet and integrated JavaScript code.
      • Re: (Score:3, Interesting)

        'integrated JavaScript code'

        ...as opposed to what? JS that isn't integrated...? I knew someone would complain. A rose by any other string of characters...

        The uppercase 'A' should be enough of a hint as to why I went with that particular label :) - No? Since when is 25,000 lines small...?

        For the grammar goons among us:
        applet ['aplit ] noun - Computing A very small application, esp. a utility program performing one or a few simple functions.

        And a utility program it was. Put up to accomplish a te
        • Re: (Score:3, Insightful)

          In this case it was easy enough to do, which meant we were providing the reports that senior management needed right away, giving us time to relax and build a proper & full scale SQL replacement.

          It strains credibility to claim that, after producing something functional, management would give you the time to replace it with something such that, "the recipients never knew when we migrated from the stop-gap to the final".

          And I don't mean that as a typical geek management-slam - If they can't tell the
    • 25,000 lines of Javascript ? What could you possibly be doing which requires that level of Javascript interaction ?????
      • Re:JS (Score:5, Funny)

        by ignavus (213578) on Wednesday December 20 2006, @05:25AM (#17310610)
        "25,000 lines of Javascript ? What could you possibly be doing which requires that level of Javascript interaction ?????"

        document.write('25,000 bottles of beer on the wall, 25,000 bottles of beer. Take one down and pass it around - 24,999 bottles of beer on the wall');
        document.write('24,999 bottles of beer on the wall, 24,999 bottles of beer. Take one down and pass it around - 24,998 bottles of beer on the wall');
        document.write('24,998 bottles of beer on the wall, 24,998 bottles of beer. Take one down and pass it around - 24,997 bottles of beer on the wall');

        etc ...
        • Re:JS (Score:4, Funny)

          by mikek3332002 (912228) on Wednesday December 20 2006, @05:54AM (#17310742) Homepage
          document.write('25,000 bottles of beer on the wall, 25,000 bottles of beer. Take one down and pass it around - 24,999 bottles of beer on the wall');

          A much better form for 25000 lines would be having, 12499 bottles of beer on the wall lines, an initlization statment, and a decremeant function after every write line. That way you can easily modify the code to start off with what ever number you want.
          • Re:JS (Score:4, Funny)

            by Anonymous Coward on Wednesday December 20 2006, @07:07AM (#17311040)
            Also, it's a good idea to Write and Save your JavaScript a Word document (eg in an editor like Notepad), not scrawled in Paintbrush and saved as a Bitmap File. It's funny how the Internet can't compile my Paintbrush Javascripts lol! My fried says thats how all the best programmers do it, but I can't get it work. maybe I don't get something? something vital? I think that must be it
            • Re:JS (Score:4, Funny)

              by Anonymous Coward on Wednesday December 20 2006, @08:01AM (#17311314)
              My sarcasm detector exploded. ow.
          • Re:JS (Score:4, Funny)

            by hobo sapiens (893427) <cminor9@gmaiMONETl.com minus painter> on Wednesday December 20 2006, @10:32AM (#17312948) Homepage
            I only had 3 lines.
            Yeah, 3 lines and an endless loop. You meant:

            for(var i=25000;i>0;i--)
            document.write((i + ' bottles of beer on the wall,' + i + ' bottles of beer. Take one down and pass it around ' + (i-1) + ' bottles of beer on the wall\n');

            Dude, this is slashdot. You can't be posting endless loops like that, that could be dangerous! Have you any idea how many geeks will be frozen in front of their computers until they involuntarily fall asleep?
      • by hummassa (157160) on Wednesday December 20 2006, @05:31AM (#17310642) Homepage Journal
        Any serious Ajax application.
      • Re:JS (Score:4, Informative)

        by HxBro (98275) on Wednesday December 20 2006, @05:52AM (#17310736) Homepage
        After writing javascript for the past 6 years on digital tv platforms, I can say I've seen EPG's, Games, Apps running on liberate based set-top boxes and various IPTV set-top boxes could be running apps of similar size at time too.

        Granted you do try keep the sizes down but in some cases especially and EPG you do end up writing lots of code.
      • Re:JS (Score:5, Informative)

        by h2g2bob (948006) on Wednesday December 20 2006, @05:55AM (#17310746) Homepage
        How about Mozilla firefox [mozilla.org] (or any of it's extensions).
        • Re:JS (Score:5, Informative)

          by foniksonik (573572) on Wednesday December 20 2006, @10:31AM (#17312934) Homepage Journal
          How about Dreamweaver? Have you ever looked at it's WYSIWYG code? All Javascript. In fact the entire UI is 90% Javascript.... you can customize the whole app by editing, you guessed it Javascript.

      • Re:JS (Score:5, Funny)

        by walt-sjc (145127) on Wednesday December 20 2006, @08:27AM (#17311460)
        25,000 lines of Javascript ? What could you possibly be doing which requires that level of Javascript interaction ?????

        1000 lines of application code, and 24,000 lines of browser compatibility code.
  • Dense != Good (Score:5, Insightful)

    by Marcus Green (34723) on Wednesday December 20 2006, @04:43AM (#17310410) Homepage
    According to the article

    "My friend and colleague Stuart Halloway, one of the foremost experts on Ajax, begins a JavaScript class with a provocative statement: "By 2011, we will recognize JavaScript as a language with a better set of features for developing modern applications." He then says that JavaScript programs are often 10 times as dense as similar Java programs and goes on to show the language features that make it so."

    The author seems to equate dense with good, not an association I make
    • by MichaelSmith (789609) on Wednesday December 20 2006, @04:45AM (#17310428) Homepage Journal
      The author seems to equate dense with good, not an association I make

      By that standard APL would be hard to beat.

    • Re:Dense != Good (Score:5, Interesting)

      by sholden (12227) on Wednesday December 20 2006, @04:59AM (#17310502) Homepage
      Since developers seem to code about the same number of lines of code/statement per unit time, regardless of language. 10 times as dense means the developers are 10 times as productive. Since programmers are reasonably expensive needing 1/10th as many is a good thing.

      But Javascript is no where near 10x as "dense" as Java, http://www.theadvisors.com/langcomparison.htm [theadvisors.com] while flawed in many many ways puts Perl at 2.5 times as "dense" as Java. There is no way in the world that Javascript is four times as "dense" Perl...

      • Re: (Score:3, Informative)

        I consider the numbers in that comparison so deeply flawed that they can't be used for comparing density of two languages like this.

        In my experience, Ruby is about twice as dense as Perl *in direct translation* (I have taken Perl libraries and translated directly to Ruby). It is even more dense when the code is idiomatic Ruby - that might be up to 10x. Idiomatic Common Lisp is about as dense as Ruby.

        Yet, Perl comes out at 15 and Common Lisp comes out at 5 in that "programming languages comparison", an

      • 10 times as dense means the developers are 10 times as productive. Since programmers are reasonably expensive needing 1/10th as many is a good thing.

        That sounds great for little one-off scripts. However, if you are working on an application with any decent expected lifespan, well than that is just wrong. Say your average application will be in production use for 5 years (I'd think this is a pretty low estimate). In that case I'd guess your intial development costs would be a fraction of your support co
      • Re: (Score:3, Insightful)

        "Since developers seem to code about the same number of lines of code/statement per unit time, regardless of language. 10 times as dense means the developers are 10 times as productive. Since programmers are reasonably expensive needing 1/10th as many is a good thing."

        Maybe, but writting the program is fast. What is slow is writting a program that works.

        Now, How does Javascript helps you to wite code that works at the first try, or maintanable code, or code that is easier to debug? Well, the answer is t

    • by D-Cypell (446534) on Wednesday December 20 2006, @05:00AM (#17310504)
      The author seems to equate dense with good

      The irony of this is so elegantly compact I am concern a singularity may form around the vacinity of this article.
  • by cyclomedia (882859) on Wednesday December 20 2006, @05:06AM (#17310534) Homepage Journal
    Would be nice to have everything my way, the sheer built in extensibility of the language is in my opinion nothing short of beautiful, and something other languages could do well to imitate (check out D [digitalmars.com], for example).

    allow me to elaborate, suppose you want to know if the version of the language on your platform supports an intrinsic array push function, and if not, attatch your own:

    if( !Array.push )
      Array.prototype.push = function( item ){ ... }
    firstly the reference to .push in the if has no brackets, so it becomes a pointer to the function within the intrinsic Array class. you can then create a function and assign it to that pointer. Sheer magic and gorgeously intuitive.

    sticking with arrays you can grow and shrink them with little to zero fuss:

    function array_push( arr , item )
      arr[arr.length] = item;
    magically the array is one index longer. you can just set arr.length and it will append or delete indexes for you.

    you can also use this to assign functions to other object's handlers, most notibly events

    someObject.onclick = myFunction
    But this has brought up the thing that really really needs fixing, suppose i want that onclick function to pass some info to myFunction when i call it i have to do this

    someObject.onclick = function(){ myFunction( this.someAttribute ) }
    so instead i've created a function inline to hold my custom function, firstly it's not immediatley obvious to what object the "this" applies. if i'm running this code in a class does the this mean the class or someObject, one hopes it means the someObject.

    next is the scope issue i've talked about suppose i'm dynamically creating objects on the fly and want the callback to reflect the id thus

    for( i=0 ; i<10 ; i++ )
    {
      someObject[i] = new SomeObject();
      someObject[i].onclick = function(){ myFunction( i ) }
    }
    every single object will pass the value of 10 to myFunction, because after the function has finished the instance of i in memory that was used is still sat there and every myFunction has been given a pointer to it, not the value it was when it was initialised!

    so some oversights still exist, if only there were ways you could explicitly state "pointer to" or "value of" like in, oh, every other language including visual basic
    • by Shano (179535) on Wednesday December 20 2006, @05:37AM (#17310670)

      That isn't really an oversight, it's the way closures work. Most functional languages let you create closures explicitly so the problem doesn't arise. Javascript does it automatically, and usually when you don't expect it. In Javascript, you can do:

      someObject[i].onClick = function(i) { return function() { myFunction(i) } } (i);

      That creates a closure for each handler, with its own copy of i, so they will all get the values you want. I have no doubt there are other ways to do it, but this works for me.

    • While I agree that some of the concepts you mention could be useful, I don't see that Javascript's implementations are particularly powerful or elegant.

      It's hard to comment on the function-attaching example you gave, since obviously any real implementation of most languages already has functions such as those you describe. In general, however, I've found these dynamic features to be overhyped, and usually no substitute for having a decent design in the first place. I don't miss them in languages where the

  • by Radium Eyes (1041164) on Wednesday December 20 2006, @05:08AM (#17310540)
    JavaScript/ECMAScript really is an interesting language; the way objects work takes some getting used to, but it's powerful, and definitely definitely not a toy language. It's when you bring the HTML DOM and browser inconsistencies into the equation that things start to get painful.
  • by vhogemann (797994) <victor.hogemann@eti@br> on Wednesday December 20 2006, @05:24AM (#17310604) Homepage
    The inconsistence between the two major implementations, Mozilla and IE. And the huge amount of annoying bugs that IE has.

    I don't hate JS, its a rather nice language, but I tend to keep minimal use of it on my applications because I really hate to lost one entire day fighting against IE.
  • by Anonymous Coward on Wednesday December 20 2006, @05:29AM (#17310636)
    javascript is too hard to unittest but most of that has to do with the web browser container . javascript is a victim of its environment.
  • Me too (Score:3, Interesting)

    by Jens de Smit (1041964) on Wednesday December 20 2006, @05:36AM (#17310666)
    I am one of those people that cursed JavaScript (after being enthusiastic about it when I was 14). I am just now beginning to turn around and think "well, it IS pretty nice". One of the things that has changed is that it does not "[mutate] faster than a fruit fly in an X-ray machine" (bonus points if you know who wrote this) anymore, with support becoming more standard over different interpreters, and incompatibilities becoming better documented and workaround libraries that unify the differences all over the place. Debuggers also become more widely available, helping the people when they exclaim "WHY the HECK doesn't it work this time!". It's still easy to shoot yourself in the foot with it, but hey, the same goes for C. At least it generally does not blow your leg up like C++. This behaviour is caused by the extreme felxibility of the language, which also allows for interesting constructions, as long as you're careful as a programmer. In other words: you have to know what you're doing to keep the code organized and understanable, something that is lacking with most starting web developers. Still, the availability and functionalty of JavaScript allows rich, interactive web applications to be developed, which is a good thing if you ask me.
  • by master_p (608214) on Wednesday December 20 2006, @05:41AM (#17310692)
    Javascript is a fine language with elements from functional and object-oriented programming. The problem with web development is the whole environment:

    1) the coupling of the UI with the code that actually does stuff.
    2) the non-efficient and error-prone methods of communication between client and server.
    3) the non-existent security regarding JS code; anyone can see it.
    4) the mixing of a tagged document language with a programming language.

    Ideally, web applications should only consist of source code in one language which is clever enough to be able to provide all the necessary abstractions. In reality, such a language does not yet exist, making web applications development 10 times more difficult than what they should be: the minimum number of languages to use for a web app is 5: 1) html, 2) css, 3) javascript, 4) java/php/ruby/python/perl/whatever, 5) XML...and let's not count the various XML schemas required for various domains of the back end, because the number of 'languages' one needs to know will grow exponentially!

  • Dear god no. (Score:3, Insightful)

    by el_womble (779715) on Wednesday December 20 2006, @05:41AM (#17310694) Homepage
    My wish for web 3.0 is that Javascript is replaced entirely. The ONLY thing that Javascript has going for it is ubiquity (which I guess is down to its ease of implementation). Its not all Javascripts fault, in general, as in most things webby I blame Microsoft, but hte language itself seems to make everything you write look lke a dogs dinner.

    Wouldn't the web be a nicer place if you could script the browser using Ruby or Python? Can you imagine the fun you could have working with constructs like:

    @page.findById( "myID" ).each do |ajaxReturn| ... end

    The web could be beautiful. Next on my hit list is an improved HTML / CSS. Should rounding corners, or drawing shapes / shadows really be done with gif/pngs?
  • by Aphrika (756248) on Wednesday December 20 2006, @05:49AM (#17310724)
    Respect is earned, not given. As far as I'm concerned, AJAX has given JavaScript a new lease of life. Without it, there would be no Gmail, no Google Maps, or at least not in the way we've come to admire them. When you see the fantastic stuff Google (and Windows Live for that matter) produce, XMLHTTP was the catalyst that made that possible, but all the donkey work is done by JavaScript.

    Thus I have a lot of respect for it as a client scripting language, in most cases it's the only way of getting something done in a browser.
  • by tacocat (527354) <tallison1@twm i . r r .com> on Wednesday December 20 2006, @06:11AM (#17310828)

    Look at the history of Javascript. It's not the history of a programming language. It's the history of a marketing battleground.

    Programming Languages have a few key elements that Javascript lacks. For one, everyone who writes Perl, Ruby, Java, Python, even Bash expect it to have consistent behaviour where ever it might be. And for that behaviour to be well documented, reliable, and owned by the language itself.

    Javascript has an evil dependency to run based on the Operating System and Browser that you are using. Mozilla on Windows works differently than Mozilla on Linux. Mozilla on anything works different than Opera or MSIE. MSIE6 works differently than MSie7. And some of these differences in javascript behaviour isn't really javascript. It's javascript trying to do CSS/DHTML stuff.

    If you were to have something similar under a real programming language there would be an active development team working to resolve the differences and get consistency in the language. The finest example of this is the Java JVM. It tries to be write once run anywhere. I don't know that it actually accomplishes that -- but it's closer than javascript.

    javascript has no such activities. I don't do much with Javascript but when you pull a 10 year old book off the shelf you find 1/2 of it is talking about MSIE vs Netscape in how to work around code differences. Then you get a new Javascript book and it's still talking about many of the same problems a decade later. That's a dead language lacking any real development.

    AJAX is cute because Microsoft went ahead and implimented something on their own and didn't bother telling anyone about it. I'll assume that Mozilla implimented the exact same thing but under a different name because they were afraid of getting sued. Why they did it doesn't matter. The fact that they implimented the exact same thing under a different name is why Javascript must fail. It's not a real language. You won't find a language the does the exact same thing in two different commands and those two different commands only work on distinctly different machines.

    If someone takes Javascript away from the companies and starts to impliment there own version of it there's no chance. Javascript needs a replacement.

  • by sveinb (305718) on Wednesday December 20 2006, @06:41AM (#17310926)
    I've been using PHP and Perl server-side and, reluctantly, JavaScript client-side for years before I actually bothered learning JavaScript. When I finally did, I discovered a language which was similar to PHP and Perl in that it supported most, if not all of their language constructs and which in many ways was more elegant (IMHO). So my dream was to use JavaScript both server- and clientside. That can be done in .net/mono, I guess, but I prefer the lightweight nature of PHP, Perl, Python etc. So I started http://www.sf.net/projects/jsext [sf.net] - check it out! The plan is to support C libraries (done on Linux, Windows version under construction) and Python modules (not done). There are other, similar projects, too: http://en.wikipedia.org/wiki/Server-side_JavaScrip t [wikipedia.org]
  • by ajs318 (655362) <{sd_resp2} {at} {earthshod.co.uk}> on Wednesday December 20 2006, @07:21AM (#17311086)
    JavaScript has one really, really nasty flaw. It "recycles" the + operator (which usually is used for adding numbers) to concatenate strings. In some languages (e.g. BASIC), which treat numbers and strings as distinct data types, this is not a problem. But JavaScript is dynamically-typed -- in other words, you don't have to tell it what is a number and what is a string; it tries to work that out for itself. And this is the source of the error. When you innocently write
    document.theform.hours.value += 1;
    in a bit of form-munging code, what happens is that a figure "1" gets appended onto the end of the value in the "hours" box. If you want to increment it by one, you have to use something like
    document.theform.hours.value -= -1;
    which is mathematically sound, but looks very weird.

    JavaScript really needs a dedicated string concatenation operator, in recognition of the fact that numeric addition and string concatenation are different operations. Unfortunately, the "dot", which would be the most obvious choice as it's already used for the concatenation operator in other languages, is already very much in use -- not to mention that changing an operator in this fashion is likely to break things. And the breakage will be even worse than register_globals in PHP, since JavaScript runs on the client side -- meaning no webmaster can ever know for sure what JavaScript engine is in use.
    • Plenty of other mainstream languages reuse + for string concatenation (C++, C#, Java), including dynamic ones (Python, Ruby). I haven't really observed any problems with that so far, but if you're really worried, you can always declare something like: function strcat(s1, s2) { s1.toString() + s2.toString(); } And use that throughout your code.

      All in all, it's really a very minor issue.

  • by CTho9305 (264265) on Wednesday December 20 2006, @08:48AM (#17311658) Homepage
    You can do some pretty fun things with it, such as a true 3d engine [ctho.ath.cx], a raytracer [ctho.ath.cx], games [ctho.ath.cx] (careful, robots is addicting!), out-of-order CPU simulators [ctho.ath.cx], and other stupid things [ctho.ath.cx] without any plugins - all the user needs is a halfway decent browser.
  • by bcrowell (177657) on Wednesday December 20 2006, @11:55AM (#17314072) Homepage

    I have a hard time understanding why I hear so many people complaining about JS as a language. I think a lot of Java programmers don't like it because it's not Java (not strongly typed, ...), and a lot of C++ programmers don't like it because it's not C++.

    The truth is that you can do some pretty amazing stuff with JavaScript. My favorite demo is here [chapman.edu]. It's a web-based calculator, and if your browser has MathML set up correctly, it'll display your equation on the fly, as you type it, in standard math notation. For instance, if you type 1/(2+pi), it displays a fraction bar, with 1 on top, and 2+pi on the bottom (pi rendered as a Greek letter). (I think recent versions of Firefox have MathML and its fonts set up correctly by default, but if not, you can download the necessary fonts (instructions) [lightandmatter.com]. For IE, you need to install MathPlayer.) What I think this calculator app demonstrates pretty dramatically is how powerful a development platform the web browser can be, without messing with the ugliness of AJAX at all. WYSIWYG mathematics typesetting is the kind of application that people used to pay $100 for ca. 1995, and now it's not only free, it's open-source, and it's an app that you can just run in your browser, without having to install anything.

  • by bryanbrunton (262081) on Wednesday December 20 2006, @12:01PM (#17314150) Homepage
    While developing an Ajax application called Grand Strategy, an implementation of the board game Risk, I have found one of my main gripes with Javascript to be the download times involved with using large amounts of it. There are things that you can do to mitigate: gzip compression, displaying progress bars, use short variable and function names, and then caching. There are ways to do dynamic downloading of portions of a library; you can see these in Dojo. However, these dictate that you radically structure your code to support it.

    It would be very nice if the whole browser based development environment had mechanisms to deal with the dynamic loading of javascript.

    Next we come to the next major javascript issue: the unreliable browser cache. Users of my game will occasionally not be able to log in, or a portion of the game becomes unusable, even after having played the game for weeks on end. Inevitably, some javascript in their browser's cache will have become corrupted, or seemingly partially downloaded.

  • prototype.js (Score:4, Insightful)

    by Lothar (9453) on Wednesday December 20 2006, @01:40PM (#17315462)
    I have one word for all of you: "prototype.js" ( http://prototype.conio.net/ [conio.net] ). The day I discovered prototype.js I stopped hating javascript. It also made me appretiate the really cool ways javascript lets you do inheritance etc + reading the prototype.js code really gets you learning.

    If you also use Firebug (make sure you get the latest beta) for debugging then programming web and javascript becomes fun!

    With prototype.js the javascript code becomes probably 30-70% smaller. No self respecting javascript programmer should be without prototype.js. It rocks!
    • by tpwch (748980) <slashdot@tpwch.com> on Wednesday December 20 2006, @04:53AM (#17310468) Homepage
      Java and Javascript? Why would anyone do that, since those two are not related other than the name. Sun developed Java, and Netscape developed Javascript. Totally independent of each other. I'm starting to get tired of people thinking that they have something to do with each other.
    • by Aqua OS X (458522) on Wednesday December 20 2006, @06:14AM (#17310840) Homepage
      Developing interactive content for the web is a lot like building a house out of crap you find at the junk yard. None of the materials are great, you'll be forced to use a lot of jankie things you'd rather not use, and you may need to substitute sheet-rock for side panels from an '82 Corolla.

      In the case of anything involved in web development, I use tools because they're the best thing for the job. Unfortunately, "best" for web dev tools usually means "only" or "no one will be able to view your page if you develop with something else."

      Java Script / J Script is the devil. Development is a sloppy crap shoot, but we use it because it's there. It's now being used for ridiculous things that it was never really designed for.

      On one hand, web 2.0 AJAX sites are cool, on the other hand, AJAX makes me throw-up a little bit in my mouth every time I type it's name.
          • Re:Disagree (Score:4, Insightful)

            by arevos (659374) on Wednesday December 20 2006, @10:18AM (#17312756) Homepage

            In what bizarro world do you live where having a DOM interface means "a very reach featureset"?

            I said, "As a language". Javascript's standard library is small, but the functionality the language itself supports is quite advanced. Closures, prototyping, mutable objects, and consistent OO (i.e. everything is an object), make Javascript rather flexible; just look at the additions Prototype has added in.

            Javascript has no threads, the lack of thread control structure therefore doesn't matter much.

            Ah, you're quite correct; Javascript is singled threaded. However, considering the amount of asynchronous callbacks from setTimeout, setInterval and XMLHttpRequest, one has to wonder whether the very lack of threading could not be construed as a disadvantage on its own. Since each Javascript function is axiomic, one would have to split up complex functionality to run across several functions.

            I strongly disagree: Javascript has no standard library.

            What do you mean by "Javascript"? Are you referring to the ECMAScript dialect (which, so far as I'm aware, does have a standard library), or are you using "Javascript" to mean "Any ECMAScript browser implementation" (in which case you are technically correct)?

            Regardless, the standard libraries of JScript and Javascript overlap considerably, so although you can point out, quite correctly, that ECMAScript does not define a standard library per se (so far as I am aware), from a practical standpoint the major browsers have a number of EMCAScript objects in common, which mounts to the same thing as a standard library in practise.

    • It is not possible to have two methods with the same name and different parameters (only one of those will ever be called).

      Because Javascript has no ways of dispatching: all functions (remember that Javascript methods are exactly like functions) use varags, and the arguments you ask for are but pointers to vararg cells.

      Example:

      1. function foo(a, b, c) {
      2. return [a, b, c, arguments]; // `arguments` holds every single argument of your function no matter what
      3. }
      4. foo() // -> [null, null, null, []]
      5. foo(1) // -> [1, null, null, [1]]
      6. foo("foo","bar","baz","buzz","bon") // -> ["foo","bar","baz",["foo","bar","baz","buzz","bon" ]]

      On the other hand methods behave like objects. One can have arrays of methods and then call mymethods[2](param);!

      It's not that JS functions "behave" like objects, JS function are objects, period. Callable objects maybe, but objects nonetheless, they're no different from strings, integers or lists in that aspect.

      And this is one of the nicest features of the language (along with lexical scoping and complete closures)

    • by killjoe (766577) on Wednesday December 20 2006, @06:18AM (#17310854)
      To be fair you use the library as much if not more then you use the language. If I can't interact with databases, if I can't download a library that scrapes web sites, connect to SOAP services easily, authenticate against a LDAP server then no matter how beautiful the language is I can't use it.

      One lesson ruby learned early was that you don't get anywhere till you build your own version of CPAN (still the king!). Build your library, build a way to install, uninstall and upgrade your libraries smoothly and your language will take off.

      In conclusion. It's the library stupid.