Slashdot Mirror


JavaScript Creator Talks About the Future

mikejuk writes "JavaScript is currently an important language — possibly the most important of all the languages at this point in time. So an impromptu talk at JSConf given by the creator of JavaScript, Brendan Eich, is not something to ignore. He seems to be a worried about the way committees define languages and wants ordinary JavaScript programmers to get involved."

305 comments

  1. Most important of all? by jaymz2k4 · · Score: 5, Insightful

    possibly the most important of all the languages at this point in time

    Not so sure I'd agree with that summary - I don't doubt the importance of JavaScript to the modern internet but I'd be more inclined to consider the C's of this world as the main foundation of the industry.

    --
    jaymz
    1. Re:Most important of all? by thetoadwarrior · · Score: 2, Funny

      C isn't web scale.

    2. Re:Most important of all? by x*yy*x · · Score: 1, Insightful

      I don't think C/C++ are so important anymore. Sure, a lot of underlying stuff is done with them. But so much more that billions of people see everyday is done with html and javascript. More stuff is created directly with those than C/C++. Besides, there's C#, Object Pascal, Assembly, Java and tons of replacements for C/C++. That isn't really the case with JavaScript.

    3. Re:Most important of all? by mhh91 · · Score: 5, Insightful

      C (and its derivatives) power almost all web servers in use today, and without servers, there's no web. Most browsers are written in C++ today, JS saw the light of day working inside browsers. A lot of programming languages have their main implementations written in C (Ruby, Python, PHP). So, yes, C/C++ are still important in the days of the web.

    4. Re:Most important of all? by jepaton · · Score: 5, Insightful

      Virtually every device has substantial amounts of code written in C or C++. Javascript would be useless on the microcontroller I write C code for. If C and C++ were to vanish overnight we'd be back in the stone age. I won't comment on whether C and C++ belong in the stone age, but it's great that many programmers don't have to think at the lower levels of machine abstraction.

    5. Re:Most important of all? by Anonymous Coward · · Score: 0

      possibly the most important of all the languages at this point in time

      Not so sure I'd agree with that summary - I don't doubt the importance of JavaScript to the modern internet but I'd be more inclined to consider the C's of this world as the main foundation of the industry.

      ^ Agree completely with this. If you took any code done in C away from all devices on the planet today, there wouldn't be a whole lot of reason to live until tomorrow.

    6. Re:Most important of all? by VortexCortex · · Score: 5, Insightful

      C isn't web scale.

      I'm not sure if you're going for funny or not -- Just to clarify, CGI was traditionally done via C. Apache is written in C. To this day, I still write processor intensive server side code in C or C++ (with a few C libs to support cross platform code & CGI) -- Even dinky hosing services like 1&1 offer remote SSH, have C/C++ compilers installed (G++, GCC), as well as GIT.

      I wouldn't develop on any system that doesn't at least support this minimal setup -- for web development or otherwise...

      Perhaps you mean C isn't a cross platform client side sand-boxed language?
      Neither is JavaScript:

      It's not cross platform -- The amount of conditional cruft you have to add to ATTEMPT a cross-browser solution is rediculous, so much so that there are entire libraries and frameworks for client side JS just to get most of the way there, and even then, some browsers are left behind.

      It's not sand-boxed -- Modern browsers compile JS to machine code and run that... Because the language requires features that make it slow, to do it any other way (bytecode in a VM), is terribly slow.

      I use JS, but it's not all it's cracked up to be... Most devs I know only use it as a client side language because it's available -- not because the language is so great.

    7. Re:Most important of all? by somersault · · Score: 3, Insightful

      "At this point in time" however, the Cs are just doing the same as what they have been doing for decades, whereas JavaScript is becoming a more and more important part of rich, highly cross platform applications. C is good for that too, of course, but it tends to just be a part of the background implementation just now. It is generally not a driving force or limiting factor in how we choose to implement high level applications, whereas JavaScript is.

      Already other comments are streaming in (dynamically via JavaScript!) pointing out how basically all devices have software written in C at some level. I know this, the submitter probably knows it, and it doesn't change which is more important right now. For example, JavaScript has done more for making Linux viable on the desktop than C or Java ever has. So many apps these days can be written as web apps, and run on any OS and any hardware, as long as they have a decent web browser. It is currently changing, and will continue to change how we use our computing devices.

      --
      which is totally what she said
    8. Re:Most important of all? by anonymov · · Score: 5, Insightful

      It's not cross platform -- The amount of conditional cruft you have to add to ATTEMPT a cross-browser solution is rediculous

      That's not the problem of javascript - that's the problem of implementation. Do you really think it would be any better if someone invented SomeBetterScript back then - and then MS made EvenBettererScript, which would be almost, but not completely, unlike the SomeBetterScript, and then Mozilla added their own extensions, and then other browsers implemented those extensions in incompatible way, adding some of their own in process, and ...

      You see what I'm talking about? JS by itself is quite nice language - web client bindings for JS is awful thanks to all the implementors.

      And yes, libraries and frameworks are good thing and they do make browser JS crossplatform - think about how AWT/Swing/SWT makes Java crossplatform and what would happen if you had to have your own bindings and workarounds.

      It's not sand-boxed -- Modern browsers compile JS to machine code and run that.

      And that's pure bullshit. "Compile to machine code and run that" has nothing to do with sandboxing - that's what all the languages that give a bit of concern about performance do, after all. Please come back when you learn the difference between "sandboxing vs non-sandboxing" and "interpreting vs JIT compiling".

    9. Re:Most important of all? by Anonymous Coward · · Score: 3, Funny

      If C and C++ were to vanish overnight we'd be back in the stone age.

      Uuum, C/C++ is the stone age!
      If one would have written that stuff today instead of in the stone age, one would use the radical cool new language of today: Haskell.

    10. Re:Most important of all? by DarwinSurvivor · · Score: 1

      JavaScript has done more for making Linux viable on the desktop than C or Java ever has. So many apps these days can be written as web apps, and run on any OS and any hardware, as long as they have a decent web browser.

      Most linux users I know actually use c/c++ apps instead of the "web apps". Thunderbird, pidgin, gwibber, etc all beat the pants off gmail, eBuddy, twitter, etc.

    11. Re:Most important of all? by BenoitRen · · Score: 2

      And yes, libraries and frameworks are good thing

      I disagree. The web browser has to parse all of that JavaScript every time it loads a page with JavaScript that requires it. In most cases it's not even really necessary, as the JavaScript only uses a couple library functions that could easily be written by yourself (like XmlHttpRequest).

    12. Re:Most important of all? by JamesP · · Score: 1

      Virtually every device has substantial amounts of code written in C or C++. Javascript would be useless on the microcontroller I write C code for. If C and C++ were to vanish overnight we'd be back in the stone age. I won't comment on whether C and C++ belong in the stone age, but it's great that many programmers don't have to think at the lower levels of machine abstraction.

      Well, think about this for a second.

      Of course most compilers for embedded systems and small microcontrollers are C

      However, I wouldn't put past someone to take a subset (or just core JS and some metadata) and write a compiler. And I think it would be very good.

      Of course, the processor would have to have at least some 100's of KBs of memory, but I think it would be amazing.

      Think about this: JS is already very similar to C. Add Arrays, Maps and first order functions.

      Problem: plugging pointers in JS (you could have something like Pascal though - mem[0x1234])

      --
      how long until /. fixes commenting on Chrome?
    13. Re:Most important of all? by xTantrum · · Score: 2

      mod u up. Must have been a web developer who summarized the article. It's so irritating to me with the advent of web 2.0, that everyone is so focused on the web. Not the internet, the web. As a result i feel like innovation and creativity have been lost in a sea of AJAX, PHP scripts and social networks. I'm very sad to see the commercialization of the internet and seeing us so focused on just this one aspect of computing - which is really just the GUI to the net. I'm hoping thinks like the Kinect will stir things up and bring along some much needed spice in this quagmire of hodgepodge technologies hacked togeter to create a pretty face. As for the person who summarized the article. C my sig.

      --
      $action = empty(PHP) ? backToC() : unset(PHP) ; "when the concrete cases are understood, the abstractions are readily
    14. Re:Most important of all? by DiegoBravo · · Score: 5, Insightful

      > If C and C++ were to vanish overnight we'd be back in the stone age.

      If COBOL were to vanish overnight, C programmers wouldn't get their paychecks; that's stone age...

    15. Re:Most important of all? by the+eric+conspiracy · · Score: 1

      That's not the problem of javascript - that's the problem of implementation.

      The language and its implementation are not separable for practical purposes. If either one or the other is no good, the whole is no good.

    16. Re:Most important of all? by Anonymous Coward · · Score: 0

      Even JavaScript is derived from C+. Its syntax is only slightly different from C++.

    17. Re:Most important of all? by x*yy*x · · Score: 1

      Yes, like I said, underneath. But so much more people write html and javascript. And the main point is there really isn't replacement for JavaScript. However, there are several for C/C++.

      If you're just thinking what's undernearth, you might just as well say that without assembly there would be no C. Hell, without punchcard programming there would be no computers and internet at all!

    18. Re:Most important of all? by Anonymous Coward · · Score: 0

      It's so irritating to me with the advent of web 2.0, that everyone is so focused on the web. Not the internet, the web. As a result i feel like innovation and creativity have been lost in a sea of AJAX, PHP scripts and social networks.

      Yep. I think the core of the problem is that the majority of developers are focused on adding layers and creating ever-more-complex solutions, when the effort would be much better spent finding ways to simplify, modularize and standardize the code.

    19. Re:Most important of all? by Nursie · · Score: 1

      That's not weird!

      "123" is a pointer to an array of characters. "123" + 1 just moves the pointer along one position, as it should do in any sensible language.

      Pointers are awesome.

    20. Re:Most important of all? by binarylarry · · Score: 4, Funny

      Haskell will lose it's cool when someone writes a real program in it and not just code examples.

      --
      Mod me down, my New Earth Global Warmingist friends!
    21. Re:Most important of all? by somersault · · Score: 1

      And that's great for them, but the fact that so much of our time is now spent on web based services is what is making it easier for people to move away from Windows if they wish, and JavaScript is the thing that is making these sites pleasant to use (perhaps not pleasant to create of course, but at least you only have to maintain one version rather than many apps), when done correctly. I like that Facebook works the same on Windows, Ubuntu and my Android devices. I much prefer the desktop version of Facebook to the mobile app and mobile version of the site. Not everything is perfect, but it's pretty good.

      --
      which is totally what she said
    22. Re:Most important of all? by Anonymous Coward · · Score: 0

      Think about this instead: dozens of programming languages have better features than JS.

      How many times hasn't your browser eaten up all the memory (in gmail for example) because of some obscure and hard to find bug that only js can make that easy to create?

      JS is not well thought out, neither is Python nor Ruby. Look at Clojure or Haskell to see how languages look like when there is geniuses behind the wheel.

      Lisp mob anyone?

    23. Re:Most important of all? by valedaemon · · Score: 1

      I actually find myself rather hard-pressed to argue against the point at least in terms of JS's universality and necessity. Javascript has evolved far past its "hey, it'd be neat to add a pointless action/feature to this website" to becoming foundational to the page. The principle for modern web development is HTML is the structure, CSS the style, and JS the behaviour. And there's good reason for that. JS when used correctly greatly improves the user experience. AJAX became important for a reason: now one doesn't have to depend upon a page refresh to await new information. Moreover, Javascript is everywhere, so it's easy to gain access to its features. And to suit its new position, JS has gotten a major facelift thanks to frameworks such as jQuery which make it a pleasure rather than a pain to develop. With that being said, Javascript is not the end-all, be-all. It has its place, but it takes knowledge of how and when to implement it. One should not attempt to grant it server-side actions. It can never hope to compete (and nor should it) with a compiled or server-side scripting language. JS should never be the intelligence of a website. But when defining behaviour and the way elements should act, it's importance is crystal clear.

    24. Re:Most important of all? by JamesP · · Score: 1

      Think about this instead: dozens of programming languages have better features than JS.

      Like? In terms of features JS is not too shabby (closures, etc)

      How many times hasn't your browser eaten up all the memory (in gmail for example) because of some obscure and hard to find bug that only js can make that easy to create?

      Then fix the interpreter? BTW there are two significant "weights" JS carry there: network latency and DOM manipulation. You can't really blame JS if data is slow to arrive.

      JS is not well thought out, neither is Python nor Ruby. Look at Clojure or Haskell to see how languages look like when there is geniuses behind the wheel.

      Lisp mob anyone?

      Yeah, that's why there are much more projects in Haskell then on Ruby. OH WAIT.
      And they would have a hell of a time running on a microprocessor.

      --
      how long until /. fixes commenting on Chrome?
    25. Re:Most important of all? by mcavic · · Score: 1

      Sure, a lot of underlying stuff is done with them. But so much more that billions of people see everyday is done with html and javascript.

      What's more important? The Web page that lets you tell your bank where to transfer money, or the back-end process that actually transfers the money? Both can be seen as necessary, but the back-end process can be controlled by anything. The front-end is more trivial.

    26. Re:Most important of all? by mcavic · · Score: 1

      the radical cool new language of today: Haskell.

      Better yet, talk to a Ruby programmer, and he'll probably tell you that it could replace the Linux kernel with 100 lines of code.

    27. Re:Most important of all? by Anonymous Coward · · Score: 0

      Why stop at c? we'd all be a primordial sacks if assembly were to vanish over night

    28. Re:Most important of all? by Anonymous Coward · · Score: 0

      But my tiny, myopic view of things suggests JavaScript is a snake...

    29. Re:Most important of all? by Anonymous Coward · · Score: 0

      I'd be interested in benchmarks showing how much time is required to parse the JS libraries like jQuery and prototype.

      My guess is less than a second. And if pages all refer to the same copy of the JS library, it wouldn't need to recompile unless it was found at a different location.

      XmlHttpRequest has a few things that can go wrong. Plus, there's cross-browser issues you'll need to deal with manually. A library helps you deal with that more elegantly, in a cross-browser way is a huge boon.

      I agree it's more fun to do things for yourself, but others have done it before you and have done it better. It's at least worth considering something like prototype or jQuery before diving in.

    30. Re:Most important of all? by anonymov · · Score: 1

      Well, there's this article, but it's quite outdated and benchmarking technique is not clear.

      Hmm, it would be fun to compare browser JS engines' performance growth vs libraries bloat...

    31. Re:Most important of all? by telekon · · Score: 1

      I'm sick and tired of these motherfucking javascripts on this motherfucking internet!!!

      --

      To understand recursion, you must first understand recursion.

    32. Re:Most important of all? by rubycodez · · Score: 1

      you use Facebook as an example of javascript success???!!!! mass marketing and privacy invading bait for tards? That just shows how javascript is the cause of most of the net's evil. NoScript for the win!

    33. Re:Most important of all? by Anonymous Coward · · Score: 0

      well I've been a linux user for 9 years, and nowadays my email, twitter, etc.. is web based. Besides, the parent point is not what advanced users use, but the ability of telling someone, hey, try ubuntu (or whatever other easy distro) and seeing that his stuff just works. That's becoming more and more of a reality as Joe user is leaving desktop apps for web apps more and more.

    34. Re:Most important of all? by bennomatic · · Score: 1

      and then MS made EvenBettererScript, which would be almost, but not completely, unlike the SomeBetterScript

      Nice HHGG reference :)

      --
      The CB App. What's your 20?
    35. Re:Most important of all? by somersault · · Score: 1

      Yep. Facebook and Slashdot are the two sites that I visit most often, and I'm sure as hell not going to use Slashdot as an example, because it's currently a complete mess. Facebook has a few really nice JS touches like IM, and more recently they added real time thread updates. Slashdot seems to have real time updates too now, but I think it's stupid to add in that kind of thing when they haven't even sorted out the rest of the new interface's base code.

      --
      which is totally what she said
    36. Re:Most important of all? by shutdown+-p+now · · Score: 1

      Javascript is derived more from Self. It's syntax is derived from Java, which was in turn derived from C (not so much C++) - but that is purely a matter of appearance, not semantics.

    37. Re:Most important of all? by shutdown+-p+now · · Score: 1

      "123" is a pointer to an array of characters.

      Actually, no, "123" is an array, not a pointer. It decays to pointer in most contexts, but not all - e.g. sizeof("123456") will give you 7. As well, the type of expression &"123" is char(*)[4], not char**.

      In C++ this is more noticeable, because you can also have references to arrays, and thus pass them as arguments to functions without pointer decay.

    38. Re:Most important of all? by Anonymous Coward · · Score: 0

      http://www.urbandictionary.com/define.php?term=rediculous

    39. Re:Most important of all? by Anonymous Coward · · Score: 0

      JavaScript is the language of artificial intelligence. The AiMind in JavaScript for Microsoft Internet Explorer (MSIE) flits across the 'Net and takes up residence in the Web browser of the websurfing human being. Programmers have the opportunity to write AI Apps in JavaScript for the iPhone, the iPad, the Android mobile devices and other platforms.

    40. Re:Most important of all? by jsm · · Score: 1

      Haskell will lose it's cool when someone writes a real program in it and not just code examples.

      Actually, a major Perl 6 implementation, "Pugs", was written in Haskell. This is one reason Perl 6 has some Haskell features in it.

    41. Re:Most important of all? by Anonymous Coward · · Score: 0

      Hint: google "web scale". It will prevent the "whoosh".

    42. Re:Most important of all? by turing_m · · Score: 1

      Scalability is a complicated topic and it's hard to make a general statement like that.

      --
      If I have seen further it is by stealing the Intellectual Property of giants.
    43. Re:Most important of all? by L0rdJedi · · Score: 1

      How is it JavaScript's fault that millions of people choose to put their entire lives on Facebook and make it public? It happened before with MySpace. Facebook just took that idea, cleaned up the interface, and has added things like chat and messaging, causing it to, in many cases, replace email for people.

      JavaScript is just another tool that is used. If it weren't JavaScript, it would be something else.

    44. Re:Most important of all? by Anonymous Coward · · Score: 0

      What a load of bullshit. I can show you bad implementations of every programming language.

    45. Re:Most important of all? by Billly+Gates · · Score: 1

      Yes it is meant to be funny.

      It is a parody of this clip with a NOSQL fanboy trashing joins to a real database admin using MySQL. It is a pretty entertaining video that I wish more slashdotters would watch rather than join the NoSql rage as the newest coolest thing. AJAX is kind of in that now it is cool again because it webscales garbage.

      Watch the video, and others by the same guy. Webscale is a joke and C was supposed to be like MySQL in the parody.

    46. Re:Most important of all? by Billly+Gates · · Score: 1

      Your post confirms that the vast majority of my apps are web based and apps on your mobile device are 80% web based. Web applets will overtake the pc if not already. Facebook is a classic example

      I bought an Andriod phone because I wanted to learn development.

      I was surprised to find out most of Andriod/Iphone/Tablet apps are simply Html5 and Javascript. Only tiny amounts of Java or ObjectiveC for OS integration and Sql-lite access are used. I assumed it would be all Java based for almost all apps. HTML and Ajax are the default languages

      JavaScript is the most successful language in that it beat Cobol in more lines of it out there than any other language. C/C++ never caught up to Cobol in terms of lines of code out used worldwide.

    47. Re:Most important of all? by Anonymous Coward · · Score: 0

      The vast majority of app development occurs on phones and tablets. My neighbor has an Ipad2 and told me objectiveC wasn't hard because all the development is html5 and AJAX. I bought an Andriod and to my surprise it is all html5 with small amounts of Java for phone integration and SQL-lite access.

      With 400,000 apps for the mobile platforms I would say C is looking dead but all but the legacy big pcs (aka the 21st century mainframe). While it is still important, all new development is on web 2.0 and AJAX.

      I wish more languages to be ported to the browser. However at that point it turns into an operating system and the browser is really just a gui shell or an operating system component. Holy cow, maybe Microsoft was right a decade ago.

    48. Re:Most important of all? by kumanopuusan · · Score: 1

      Oh yeah! Haskell will be cool forever!
      Suck it, chumps!

      Wait...

      --
      Use of the words "good", "bad" or "evil" is almost invariably the result of oversimplification.
    49. Re:Most important of all? by Anonymous Coward · · Score: 0

      So what? If you're stuck with a bad one (for whatever reason) then it's not much comfort that a better one exists somewhere else. Your working day is still going to seem a lot longer than it is.

    50. Re:Most important of all? by Hognoxious · · Score: 1

      I don't think C/C++ are so important anymore. Sure, a lot of underlying stuff is done with them. But so much more that billions of people see everyday is done with html and javascript.

      That's like saying metal isn't important in the automotive industry because the steering wheel is made of plastic and the pedals are rubber.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    51. Re:Most important of all? by Anonymous Coward · · Score: 0

      Mod article -1: Troll

    52. Re:Most important of all? by niftymitch · · Score: 1

      possibly the most important of all the languages at this point in time

      Not so sure I'd agree with that summary - I don't doubt the importance of JavaScript to the modern internet but I'd be more inclined to consider the C's of this world as the main foundation of the industry.

      JavaScript -- just do a view source of this /. page
      or your fav.. search engine and count the number
      of JavaScript blocks of code that are on the page
      or hidden in css references.

      JS is hard to code and harder to test...
      As an interpreted language bugs only surface
      at run time.
      Foo like this (I hope it is not munged):

            [if gte IE 8]><link rel="stylesheet" type="text/css"
      followed by this
          [if IE 7]><link rel="stylesheet" type="text/css"
      followed by
          [if lt IE 9]><script src="//a.fsdn.com/sd/html5.js"

      Further complicate testing.

      As far as language design goes the folk most involved
      in the revision of JS are the ones most commonly looking
      at your personal info as a product they can slurp up
      and sell. They are for the most part not at all
      concerned with security.

      My guess is that between Facebook and Google more lines
      of JS are executed each second than any source except
      the C/C++ code of the browser and code that implements the JS engine.

      Add Flash, Java, and Air to the pile and it is a wonder
      we do not have more problems. We all know that
      our browser histories and caches are polluted by
      images of who knows what rendered as one pixel.
      Oh wait... Interpol, DHS and FBI know and that is all
      they need to bust down your door and impound your
      life and subject your family, dog and cat to body cavity
      searches and brain biopsies only aliens in science fiction do.

      If you think it is not important -- bend over...

      --
      Truth is stranger than fiction, but it is because Fiction is obliged to stick to possibilities; Truth isn't. Mark Twain.
    53. Re:Most important of all? by niftymitch · · Score: 1

      the radical cool new language of today: Haskell.

      Better yet, talk to a Ruby programmer, and he'll probably tell you that it could replace the Linux kernel with 100 lines of code.

      100 lines of code and how many GB no TB of library
      code would it pull along with it.

      The library of functionality has somehow become a
      measure of the quality of a language. This is a left
      turn that is the result of too much tin foil in ones hat.

      Library functionality for strings continues to be broken.

      Math libs are way too tangled -- we need something
      tighter like libmathhp21 and then libstat101 Schools
      try to organize classes so prerequisites are sane.
      Library functionality should take a lesson. A 5th
      grade math student working on a machine should
      need 5th perhaps 6th grade math libs and no more.

      List processing... keep it short, car, cdr

      BLoat and entangled unstructured libraries have
      killed LISP and now I need to run off and get
      some more tin foil.. the acid rain is melting
      my hat.

      --
      Truth is stranger than fiction, but it is because Fiction is obliged to stick to possibilities; Truth isn't. Mark Twain.
    54. Re:Most important of all? by DarwinSurvivor · · Score: 1

      I'm not saying all ubuntu users use thunderbird/etc, just that SOME do. And btw, these users are anything BUT advanced...

  2. i still hate it by Torvac · · Score: 2

    its incomplete and stupid at so many parts. i still wait for script type=text/lua or text/python

    1. Re:i still hate it by camcorder · · Score: 1

      I doubt that web browser developers are very inclined to put massive work on coding a python interpreter and optimize it for web. Power of JS comes from the interpreters that web browsers have today. Python framework with web browser would be a new start and interpreters of web browsers would give you more trouble than JS language gives you now. Of course in a long-run it would be better. But JS does the job, so why devs should bother if there is no apparent need for other scripting languages.

    2. Re:i still hate it by somersault · · Score: 1

      Standardising browser DOMs should be a much higher priority, though adding other scripting options would be nice.

      --
      which is totally what she said
    3. Re:i still hate it by ChunderDownunder · · Score: 1

      That's what I don't get. HTML, CSS and (ECMA)script were all put through some standardisation process and, when implemented 'correctly', should ensure consistency across all browsers. DOM on the other hand seems to have caused endless pain.

      Can't we draft a common spec for both Gecko and Webkit so at least DOM access for Safari, Firefox and Chrome works identically? (IE and Opera to please themselves). Screw backward compat - define a standard for DOM2012 and migrate from there.

  3. I have a suggestion. by mikael_j · · Score: 1, Interesting

    I know this may be considered radical and groundbreaking for those who design the language but perhaps putting in some way of letting the developer decide if he/she wants to copy an object or just create a new reference to it when doing assignment?

    For those who don't know what I'm going on about:

    var myObj = new Object();
    myObj.foo = 1;
    var newObj = myObj;
    newObj.foo = 5;
    alert(myObj.foo);

    That will display a dialog with "5" in it because newObj and myObj are basically the same object which is the opposite of how it works in most other languages that are commonly used these days.

    Oh, and there's no magic "DON'T FUCKING DO THAT!" operator either...

    --
    Greylisting is to SMTP as NAT is to IPv4
    1. Re:I have a suggestion. by gamblenic · · Score: 1

      When you say "most other languages" which ones are you thinking of, because that displaying 5 is exactly what I would expect from most other languages.

    2. Re:I have a suggestion. by mikael_j · · Score: 1

      Look at that example again. It's not alert(newObj.foo), it's alert(myObj.foo).

      --
      Greylisting is to SMTP as NAT is to IPv4
    3. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      That's exactly how most languages work, among those that have reference semantics for objects: Java, C#, Python, PHP, Ruby, Lua, Object Pascal. C++ is a counterexample, but it hardly counts as "most languages".

    4. Re:I have a suggestion. by mikael_j · · Score: 0

      Uh, if I create an object in C# then use the "=" operator to create a copy of the object then that is a copy which mean that these are two different identical objects. If I change the data inside one of these objects only this object is changed. With JavaScript the "=" operator just creates a reference to the original object and thus changing data in the "new" object actually changes the original.

      Also, the same is true with PHP. Unless you explicitly create a reference to the original object you create a copy of the object which means changing one does not change the other.

      --
      Greylisting is to SMTP as NAT is to IPv4
    5. Re:I have a suggestion. by Jamu · · Score: 1

      var newObj = myObj.copy()?

      --
      Who ordered that?
    6. Re:I have a suggestion. by maxume · · Score: 1

      Any language with objects and names (instead of variables and memory) behaves that way.

      --
      Nerd rage is the funniest rage.
    7. Re:I have a suggestion. by Timmmm · · Score: 1

      C++ at least. It's one of the biggest things I miss in Java-like languages. That and RAII.

    8. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      Lots of C++ libraries seem to miss RAII. I'm looking at you, member function, Create.

    9. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      You sir must be a terrible C# programmer if you think assignment copies objects.

      Try this:

      using System;

      static class Program
      {
                      class Foo
                      {
                                      public int foo;
                      }

                      static void Main (string[] args)
                      {
                                      var myObj = new Foo();
                                      myObj.foo = 1;
                                      var newObj = myObj;
                                      newObj.foo = 5;
                                      Console.WriteLine (myObj.foo);
                      }
      }

    10. Re:I have a suggestion. by nogginthenog · · Score: 1

      No it doesn't. In C# "=" creates a second reference, exactly like your javascript example.

    11. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      Got to love when someone who has no clue what they're talking about makes "suggestions" for a language.

    12. Re:I have a suggestion. by mikael_j · · Score: 3

      Yes, I just re-read what I've been posting here and I'm not sure what exactly I was trying to argue. I'm going to blame my hangover and the fact that I spent several days last week battling datetime handling in JavaScript (which I will maintain is an abomination simply on the grounds of not supporting ISO-8601 formatted dates in a world where everything else uses ISO-8601).

      I'm actually baffled by the fact that I managed to crank out two posts before realizing that I was rambling incoherently. Now I'm going to go drink some water and try to make my headache go away...

      --
      Greylisting is to SMTP as NAT is to IPv4
    13. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      two different identical objects

      Fucktard.

    14. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      You've been coding in Java or another language that uses references heavily . . . Java does this to improve performance (using memory addresses) and security (not giving you access to pointers).

      In C/C++, this would output "1" and the same goes for any other language that lets you choose if you want to make a copy or use a reference.

      If you want C/C++ to behave like Java, the line would read:

      var * newObj =

      If you want Java to behave like C/C++, the line would read:

      var newObj = myObj.clone( );

    15. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      Lots of C++ libraries seem to miss RAII. I'm looking at you, member function, Create.

      Unfortunately, that's a hack to deal with another problem in C++, tight-binding of classes. Unless you force yourself to always use pImpl, it is very hard to maintain binary compatibility with objects since users of classes are reliant on the old size when allocating storage from the stack or heap for it.

      A well designed library will generally see this problem and avoid it by using pImpl, only lightweight classes and templates need their guts exposed. You can hack around the failure to use a proper design with a handle/smart-pointer class ('external' pImpl) that re-abstracts that Create function back into a constructor.

      C++ is still my language of choice, but it really could have been so much better without beating the "don't pay for what you don't use" drum so hard. An invisible global const holding the sizeof(Class) would have done the trick, the compiler could just generate code that pulled the value of the const, subtract that many bytes from the stack, create a pointer to there and run the constructor. Instant forward compatibility.

    16. Re:I have a suggestion. by Dr_Barnowl · · Score: 1

      I can't speak for PHP, but in C# that only applies to primitive types. C# has exactly the same behaviour as your JavaScript snippet. As does every other language that supports reference types.


      public class RefAssign {
              public int change;
      }

      public class Program {
              public static void Main(string[] args) {
                      RefAssign oldObject = new RefAssign();
                      oldObject.change = 1;
                      RefAssign newObject = oldObject;
                      newObject.change = 5;
                      System.Console.WriteLine(oldObject.change); // Emits '5' on the console
              }
      }

    17. Re:I have a suggestion. by bunratty · · Score: 3, Informative

      You're arguing for value semantics (as in C++), as opposed to reference semantics (as in Java, Python, and JavaScript). In the latter languages, what many programmers think of as objects are really references to objects. In your code, myObj and newObj are two references that point to the same single object. Don't feel bad -- I talk to many Java programmers who still don't quite grasp this concept. Good old pointer diagrams make it clear; get a book that shows references as boxes with arrows that point to the objects they refer to.

      --
      What a fool believes, he sees, no wise man has the power to reason away.
    18. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      Looks like Slashdot filtered out the ampersand in my comment. That should have read:

      If you want C/C++ to behave like Java, the line would read:

      var * newObj = 'ampersandCharacter'myObj;

    19. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      That's not suprising in the least. What part of the new operator do you not understand?

    20. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      You only made one object (new Object()), so why would you expect there to be more than one object?

    21. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      couldn't you create a CRTP template and a size_of-like function to do that for you?

    22. Re:I have a suggestion. by dr2chase · · Score: 2

      Yes, but (speaking as a language designer and implementer, and this problem is a big one) you more or less admit that the program doesn't stand on its own ("Good old pointer diagrams make it clear"). One problem with programming languages is that they are often designed by compiler writers or interpreter writers, for whom such pointy data structures are ever-so-useful, but in the so-called real world, by-value is much more often the case. "Value" is also much more useful when you set out to do things in non-micro-managed parallel; anything shared and mutable gives you the ability to observe Before and After, and sometimes your program depends on that.

    23. Re:I have a suggestion. by dr2chase · · Score: 1

      Yeah, but if you're designing a language, people like that are going to be using it. If your language design can help confused people (i.e., most people) avoid "stupid" (i.e., human, common) errors, that's a win.

      Because otherwise, it devolves down to one of those stupid "real men spray III's and V's onto Si" pissing contests.

    24. Re:I have a suggestion. by h4rr4r · · Score: 1

      Yet another reason to avoid C#. If I want a pointer to an object I will use that.

    25. Re:I have a suggestion. by lucian1900 · · Score: 1

      C++'s spurious copy shouldn't be inflicted on any other innocent language. References to objects work like references to objects.

    26. Re:I have a suggestion. by gbutler69 · · Score: 1

      This has got to be one of the stupidest criticisms of Javascript I have ever read.

      --
      Over-the-top Response Guy! Giving "Over-the-Top Responses" since 1970.
    27. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      Wrong for both C# and PHP.

    28. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      which is the opposite of how it works in most other languages that are commonly used these days.

      Seriously? I guess Java, Python, and C# are not commonly used these days. C and C++ copy objects on assignment, but they aren't the only game in town.

    29. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      This is the behavior you'd expect from any object oriented language, and quite frankly except from the clutch that is C++ I can't think of one that doesn't work like that.

      Maybe learning some basic programming concepts might be a better use for your time instead of criticizing things you don't understand on slashdot.

    30. Re:I have a suggestion. by bunratty · · Score: 1

      It's similar to the situation with floating point arithmetic. Who hasn't been caught off guard when 1/3 + 2/3 != 1? It's just something you need to know when you write programs -- floating point numbers are approximations of real numbers. Another thing programmers need to know is that pointers (or references) point to other entities.

      --
      What a fool believes, he sees, no wise man has the power to reason away.
    31. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      What r u talking about? If I adding an object I expect to be passing a reference. What language are you using where assigning an object deep copies the object? That seems absurd to me.

    32. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      That will display a dialog with "5" in it because newObj and myObj are basically the same object which is the opposite of how it works in most other languages that are commonly used these days.

      That is completely false. You are really showing your ignorance to general programming constructs with that statement. How is that behavior any different than other popular languages which use references? Lets take a look at C# and Java:

      C#:
      var foo = new Foo();
      foo.Baz = 5;
      var bar = foo;
      bar.Baz = 7;
      Console.WriteLine(foo.Baz); // 7

      Java:
      Foo foo = new Foo();
      foo.setBaz(5);
      Foo bar = foo;
      bar.setBaz(7);
      System.out.println(foo.getBaz()); // 7

    33. Re:I have a suggestion. by dr2chase · · Score: 1

      How sure are you that you really do need to know that? 1/3 and 2/3 are rational numbers, we can represent them exactly, and make the identity work. That's one way around the problem. Another way around the problem is to always emit a warning when the = and != operations are seen applied to floats (this won't solve all problems -- is 1/3+2/3 less than 1?).

      People get extraordinarily comfortable with their status quo, and assume not only that that is how the world works, but that is how the world MUST work. It ain't necessarily so.

    34. Re:I have a suggestion. by mthamil · · Score: 1

      How is this the opposite of how most other languages work? This is obvious behavior, both myObj and newObj contain references to the same object.

    35. Re:I have a suggestion. by anonymov · · Score: 1

      Well, this status quo is how the world MUST work if world wants to get any decent performance from existing CPUs, you know.

      There are rationals and decimal floats - you can find libraries for any language and some languages include them in the core - but they are not commonly needed, as noone wants to trade speed for (unnecessary in most cases) precision.

    36. Re:I have a suggestion. by timothyf · · Score: 1

      Oh, and there's no magic "DON'T FUCKING DO THAT!" operator either...

      There isn't one in most Object Oriented languages either; I'm curious what about your design would need copies of objects anyway. I've run across very few instances where I thought they were useful. Lucky for you, someone already solved that for JS: http://james.padolsey.com/javascript/deep-copying-of-objects-and-arrays/

    37. Re:I have a suggestion. by dr2chase · · Score: 1

      Keeping in mind that all this discussion is in the context of that high-performance language, JavaScript :-). People are willing to trade away performance for other things, including fewer unpleasant surprises.

      In addition, I recall from my very checkered past, real live numerical analyst types seriously considering the possibility of using constructive reals to calculate error bounds after a floating point matrix calculation. The reason is that the number of "cheap" FP operations is O(N-cubed), but the error computation is O(N-squared), and calculating exactly buys you some additional precision. We had, I recall, a Fortran interpreter, running on a Sun-2, connecting over ethernet (the original ethernet, with terminators and vampire taps) to a constructive reals engine running on a Vax 11/750 (because it was written in a language not yet ported to the Sun).

    38. Re:I have a suggestion. by anonymov · · Score: 1

      Keeping in mind that all this discussion is in the context of that high-performance language, JavaScript :-)

      Actually, thanks to JS's popularity, it gets quite nice performance from JIT compilers today.

      It has enough speed to write, f.e., game engines in browser JS - and you don't need precision there. Just as you don't need precision, but do need speed in other common javascript FP use cases, such as builidng/manipulating graphics.

    39. Re:I have a suggestion. by Rockoon · · Score: 1

      After reading all the comments thus far under your post, I can only conclude that you really havent thought this through.

      Do you understand the difference between a shallow copy and a deep copy? The fact that there *is* a difference is why these languages DO NOT create copies of objects with the equals operator, for the operator does not describe the type of copy that you want (I suppose that you expect a shallow copy, ala 'rep movsb' ?)

      An object copier is best implemented as a method of said object so that the full terms of the copy can be described in detail...

      ...which leaves us with a free '=' operator which can be used for something as mind-blowingly common as creating a reference to the object, something that also made sense as a candidate operation for the '=' operator before we examined things in detail to see which was better.

      --
      "His name was James Damore."
    40. Re:I have a suggestion. by aepurniet · · Score: 1

      var newObj = myObj;

      every language that is taken seriously does the way you describe. if you want to create a new object

      var newObj = myObj.clone() or

      var newObj = new Object(myObj)

      why would you expect something to make a copy of an object without you explicitly stating that you want a copy?

    41. Re:I have a suggestion. by Anonymous Coward · · Score: 0

      of course, there is no .clone() function for javascript objects and C++ does it the other way around. otherwise you were right.

    42. Re:I have a suggestion. by Zontar+The+Mindless · · Score: 1

      ... I spent several days last week battling datetime handling in JavaScript (which I will maintain is an abomination simply on the grounds of not supporting ISO-8601 formatted dates in a world where everything else uses ISO-8601).

      I find it rather baffling that you had to spend more than one hour on this task.

      Protip: You have a Date object. It has very consistent and predictable characteristics. You're able to extend it on demand, just as with any other JS built-in. Extend it, and get on with your life.

      --
      Il n'y a pas de Planet B.
    43. Re:I have a suggestion. by hotdog.sk · · Score: 1

      That will display a dialog with "5" in it because newObj and myObj are basically the same object which is the opposite of how it works in most other languages that are commonly used these days.

      No, C++ is only one other language commonly used these days. Which other language has this copy on assignment semantics?

  4. Just typical JavaScript ignorance. by Anonymous Coward · · Score: 3, Insightful

    JavaScript isn't even that important to the modern Internet. It's pretty isolated to the Web, and even there it's only seriously used by a small number of sites. It just gets a lot of undeserved hype.

    Indeed, C and its derivatives and related languages are in fact the main foundation of virtually all software. For every line of JavaScript in a given web site, there will be hundreds, if not thousands, of lines of C or C++ code doing the real work within the JavaScript interpreter, the web browser, the client's OS, the routers between the client and server, the server's OS, the web server, the back-end web app (or the language it's implemented in), the back-end database server, and so forth.

    1. Re:Just typical JavaScript ignorance. by itsdapead · · Score: 5, Insightful

      JavaScript isn't even that important to the modern Internet. It's pretty isolated to the Web,

      Yup, and the web isn't very important to the modern Internet at all.

      and even there it's only seriously used by a small number of sites.

      Just a few tiny, insignificant ones like Slashdot, Google (Docs/Maps/GMail) and any other website that contains anything more interactive than a form submit button. Except the ones that use Flash (but then the ActionScript language used by Flash developers is a superset of ECMAScript.) - or Java, which really is "only used seriously by a small number of sites" (for given values of "small" and "seriously").

      Its also the only game in town if you want to target iOS, Android and desktop browsers with the same codebase. Meanwhile, Java's star seems to be falling, .Net/C#/VB (however well respected) are effectively Microsoft-only.

      For every line of JavaScript in a given web site, there will be hundreds, if not thousands, of lines of C or C++ code doing the real work within the JavaScript interpreter

      Well, yes, that will be true of any "scripting" language.

      The statement in TFA that Javascript is "possibly the most important of all the languages" is flamebait, but your position is equally absurd.

      The "contest" is probably Javascript vs. Python/Ruby/Perl/PHP. ("CoffeeScript", mentioned in TFA seems to be an effort to make JavaScript look more like the first three of those to appease the haters of curly brackets - where's the campaign to make Javascript look more like PHP, I ask !? :-) ).

      --
      In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
    2. Re:Just typical JavaScript ignorance. by TheGratefulNet · · Score: 1, Flamebait

      when I turn JS off (which is 90% of the sites I visit) I don't miss a thing. in fact, turning it off saves me from a lot of spam.

      I have zero respect for javascript and less for a creator who thought we NEEDED this junk.

      --

      --
      "It is now safe to switch off your computer."
    3. Re:Just typical JavaScript ignorance. by Anonymous Coward · · Score: 0

      "where's the campaign to make Javascript look more like PHP, I ask !? :-) )."

      It's right here: http://phpjs.org/
      A large number of PHP functions implemented in pure javascript.

    4. Re:Just typical JavaScript ignorance. by Rhaban · · Score: 1

      where's the campaign to make Javascript look more like PHP, I ask !? :-) ).

      here: http://phpjs.org/

    5. Re:Just typical JavaScript ignorance. by itsdapead · · Score: 1

      A large number of PHP functions implemented in pure javascript.

      I don't know - there was I making a joke about PHP's reputation as an abomination amongst programming languages and you have to go and post a link to something potentially bloody useful.

      --
      In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
    6. Re:Just typical JavaScript ignorance. by Anonymous Coward · · Score: 0

      What a silly thing to say. To extend your logic the c language is also insignificant as it depends on translation to machine code.

    7. Re:Just typical JavaScript ignorance. by souravzzz · · Score: 1

      When I don't use C based programs (which is 90% of the software ever produced) I don't miss a thing. In fact, it saves me from lot of malware and stupid programs. I have zero respect for C and less for a creator who thought we NEEDED this junk. Using a good thing for stupid puproses does not make it bad. The fact that you rely on JS on 10% of the sites you visit shows that it is useful.

    8. Re:Just typical JavaScript ignorance. by Zontar+The+Mindless · · Score: 1

      Hmm, I went the other way round -- implemented a bunch of JS features in PHP, back in the day.

      --
      Il n'y a pas de Planet B.
  5. fix JavaScript, please by t2t10 · · Score: 2

    While I generally don't like stuff coming out ouf technical committees, sometimes the alternative is worse... like in the case of JavaScript.

  6. I call BS by Anonymous Coward · · Score: 1

    JavaScript is currently an important language â" possibly the most important of all the languages at this point in time.

    bullFUCKINGshit.

  7. Javascript is a disaster by mlwmohawk · · Score: 2, Insightful

    The problem with javascript is that it is one of the WORST languages and environments. I dare to say Brandan owes the whole industry a great big apology. If he were japanese, there is a traditional act he should perform. Javascript doesn't have types to speak of, doesn't handle numbers very well, I mean seriously "+" appends two numbers? No scope to speak of. It looks object oriented, but has no real notion of classes. No inheritance. All of the features that have made languages "safer" and "easier" to program in, javascript lacks. I can't think of one innovative or positive aspect of javascript, and lament that it is, alas, the only option at this point. Visual Basic is a better language, and I hate VB too.

    Javascript is a hack by a person who didn't know better and we are stuck with it. I shake my head. For decades people have been creating new computer languages. ruby, java, perl, erlang, c++, c, pascal, basic, cobol, fortran, etc. All of these had an objective, to allow some some form of expressiveness or simplicity. Yet, javascript is on all the browsers. Irony for sure.

    1. Re:Javascript is a disaster by anonymov · · Score: 1

      either you're just trolling or you don't have an idea what are you talking about.

      "doesn't have types" can be said about half of modern languages - you mention ruby and perl, f.e.

      "+" doesn't append _two numbers_, but it can append _number to string_ - which you can have in any language with operator overloading.

      "looks object oriented, but has no real notion of classes" and "no inheritance" comes from your ignorance, you should read up on prototype-based OO, really.

      P.S.: Insightful? Mmmm, yeah, that gave me an insight in the mind of ignorant haters a bit.

    2. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      I mean seriously "+" appends two numbers?

      In what context? If you simply have two numbers (and nothing else), "+" adds them together, exactly as you'd expect.

      Javascript is a hack by a person who didn't know better

      I don't think it was ever intended to be that "serious" a language when it started out, only a simple scripting tool, so I'm not sure the "didn't know better" criticism is valid. I'd guess it's a "hack" insofar as most of the more advanced features were added in a semi ad-hoc manner, starting from a base that you probably wouldn't have started from in advance if you'd known what you were aiming for.

      But that's with the benefit of hindsight.

    3. Re:Javascript is a disaster by TheRaven64 · · Score: 4, Informative

      It looks object oriented, but has no real notion of classes. No inheritance.

      I agree with most of your points, but not this one. Class based and object oriented are orthogonal. Simula was class based, but not object oriented. JavaScript and Self are object oriented, but not class based. And JavaScript does have inheritance, a reduced form of the same differential inheritance that Self has (only one parent, can only be assigned at construction time). New objects inherit from the object in the prototype field of the constructor object.

      --
      I am TheRaven on Soylent News
    4. Re:Javascript is a disaster by ltmon · · Score: 2

      I really don't think you understand Javascript quite enough to be commenting this strongly on it.

      It does have types, to speak of and to use. They are in the spec, they are in the language, they work. http://bclary.com/2004/11/07/#a-
      Since when has "+" appended 2 numbers? When they are strings I would imagine, which is exactly what most languages do. You might need to get your head around javascript types to stop this happening.
      Javascript has scope -- it's quite well defined.
      Object oriented does not mean classes, there are other ways of doing it. In particular, the prototype pattern which is followed by javascript. It can have inheritance because of this pattern also.

      Javascript has been an ECMA standard for the last 15 years, and cannot be thought of as a one-person hack in any way.

      I shake my head.

    5. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      It looks object oriented, but has no real notion of classes. No inheritance

      Your ignorance is astounding!

    6. Re:Javascript is a disaster by roman_mir · · Score: 5, Informative

      Javascript doesn't have types to speak of

      str = "10" + 2; - becomes "102"
      num = 10 + 2; - becomes 12
      num = 10 + 2 + "2"; - becomes 14

      num = "10" - 3; - becomes 7
      num = 10 / "2"; - becomes 5
      num = "2" * 4; - becomes 8

      num = 35.00;
      str = "VALUE IS: " + num; - this becomes "VALUE IS 35".

      --

      Sure, it's a bit strange, but nothing extraordinary.

      ---

      No scope to speak of

      well, it's not true really. In the following example x will have global scope and y will be local to its function:

      x=2;
      function test() {
          y = x + 3;
      }

      --

      no real notion of classes

      function Person(name, gender) {
              this.gender = gender;
              this.language;
              this.name;
              this.toString = function() {
                      return '' + this.gender + ' ' + language;
              };
      }

      Person.prototype.getName = function() {
              return this.name;
      };

      var person = new Person('Bob', 'male');
      person.language = 'English'; ...

      person.gender - this is 'male'
      person.language - this is 'English'.
      person.toString() - this is 'male English'.
      person.getName() - this is 'Bob'.
      --

      Of-course you can also just evaluate a string into a class on the fly, few language allow that:
      eval('
      var person = {
              name: "Bob",
              gender: "male",
              toString: function () {
                      return this.name + " " + this.gender;;
              }
      }
      ');

      person.name - this is 'Bob'
      person.gender - this is 'male'.
      person.toString() - this is 'Bob male'.

      No inheritance

      - well, there is the keyword "inherits" and it does allow an object to be extended and you can use the 'prototype' to have multiple inheritance.

      --
      I am not saying this language is wonderful, whatever, but saying it is lacking various features, that it clearly has, even though they look different from other languages... it's disingenuous.

      As to the question whether this language has anything that others do not, again, how about on the fly reflection via evaluation of strings into objects? When I first saw that over a decade ago, I thought it was a neat concept then, I still think it's a neat concept today.

    7. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      Javascript is responsible for more bad websites than .

    8. Re:Javascript is a disaster by maraist · · Score: 5, Interesting

      ""+" doesn't append _two numbers_, but it can append _number to string_ - which you can have in any language with operator overloading."
      function foo(x,y) { return x + y; }
      foo("5",6) == "56"

      In every other language I've seen, the CORRECTly expected result is 11 or error. Perl, C++, etc. The point is that you can never trust your input if you are expecting numeric.

      You must guard the inputs with explicit (and thus inefficient/unreadable casts). If you're using a 3rd party library, you'll be pulling you hair out trying to figure out what went wrong.

      The language is full of such wtf's. While you can happily redefine most core operations (e.g. how jQuery fixes IE), you can't overload the + operator. Call my cynical, but I don't like languages that let you corrupt basic building blocks.

      That being said, javascript is excellent at what it was designed for - and passable for what it's currently used for, but I fear for the future if it's the basis of future industrial strength applications.

      One place I WOULD like to see it extended is DB's.. CouchDB has a very nice java-script based map-reduce framework - it leads to concise and expressive code (that's really NASTY if plsql, etc are used).

      Basically javascript is excellent fragment-code. But HORRIBLE for modular libraries - having to write an entire library (like jquery) in a scoped wrapper then assigned to a mutable/corruptable symbol is sick. (Especially since library A will mutate library B without permission - hello 1970s!!)

      --
      -Michael
    9. Re:Javascript is a disaster by johnbellonejr · · Score: 1

      well, it's not true really. In the following example x will have global scope and y will be local to its function:

      x=2; function test() { y = x + 3; }

      --

      That's quite wrong. Both y and x will be global scope. You just declare y with "var" in order for it to be a function scope variable. The major problem with Javascript is that it is a hodge-podge of different languages mixed together where the semantic syntax is "C-like"; so you get a bunch of programmers who are arguing over the logic of scope when they really don't understand the rules of the language well enough.

    10. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      In the following example x will have global scope and y will be local to its function:

      x=2;
      function test() {

          y = x + 3;
      }

      --

      Not. Unless you explicitly make y local (using var) it is treated as a member of the global object (i.e. it is globally accessible).

    11. Re:Javascript is a disaster by roman_mir · · Score: 1

      You are correct, I missed 'var'.

      It does not change the fact that there is scope, it only means I made a syntax error.

    12. Re:Javascript is a disaster by roman_mir · · Score: 1

      yes, I said I made a syntax error.

      I expect another 5 comments about this, but it does not change the fact that there is scope if you do not make the same syntax error as I did.

    13. Re:Javascript is a disaster by Migala77 · · Score: 1

      ""+" doesn't append _two numbers_, but it can append _number to string_ - which you can have in any language with operator overloading."
      function foo(x,y) { return x + y; }
      foo("5",6) == "56"

      In every other language I've seen, the CORRECTly expected result is 11 or error. Perl, C++, etc. The point is that you can never trust your input if you are expecting numeric.

      If you think Javascript is weird, try executing this in C:
      "123"+1

    14. Re:Javascript is a disaster by Nocturnal+Deviant · · Score: 1

      Mod this guy up, one of the few intelligent responses on this entire article and, the only one to give examples of why he is correct instead of blithering around like he knows everything.

      Even openly admitted to making an error.

      --
      -Noc
    15. Re:Javascript is a disaster by Anonymous Coward · · Score: 1

      Whilst I agree with the thrust of your argument, there are a few mistakes.

      No scope to speak of.

      JavaScript has scopes. A variable declared in a function goes away at the end of the function, same for the body of an if, a loop, etc. Standard C/C++ rules apply that a variable declared in the parent scope carries into a child scope (variables declared before a function are accessible inside the function. Things get screwy with closures, of course, but that's typical functional crap.

      It looks object oriented, but has no real notion of classes. No inheritance.

      Yes and no. JavaScript is object oriented in that everything is an object, it just doesn't follow the traditional model. Unfortunately, this is trumpeted as a feature rather than a bug (The concept of a class is a useful refinement over the more primitive object soup style used by JS since it makes it far easier to reason about the system's behaviour — open for extension, closed for modification). The JS object model is more abstract and less intuitively helpful which makes it more difficult to use correctly but you can implement inheritance using the prototype member. eg.

      function Class1() {
          this.my_value = 5;
      }
      Class1.prototype.something = function() { return this.my_value; };
      function Class2() {
          Class1.call(this);
          this.my_value = 10;
      }
      Class2.prototype = new Class1(); // inherit
      Class2.prototype.constructor = Class2; // constructor points to Class1() due to above
      Class2.prototype.something_else = function() { return 6; }; // extend
      var obj = new Class2();
      alert(obj.something() + obj.something_else()); //16

      All of the features that have made languages "safer" and "easier" to program in, javascript lacks.

      I agree with this notion, unfortunately, I see "safer and easier" as being in direct opposition to the current trend of dynamic/duck-typing in newer languages (auto-typing [type inference] is fine). I like compiler errors, they find bugs before the program crashes, or worse, results in a production system that appends a number to a string instead of adding two numbers causing the output to be completely wrong when a difficult to trigger code path runs.

      I can't think of one innovative or positive aspect of javascript

      JavaScript is the bastard child of Scheme/Lisp, Smalltalk and Java. It inherits the polished turd ugly syntax of C/C++ (from Java), a poor implementation of everything as an object (Smalltalk) and an obsession with minimalist abstract syntax like recursive closures from Lisp. This is pretty much a match made in hell.

    16. Re:Javascript is a disaster by mlwmohawk · · Score: 1

      Since when has "+" appended 2 numbers?

      Two objects that have always contained numerical values, were assigned numerical values, are treated as strings. You always have to explicitly cast them as numbers. Which is bogus. Just the typing alone hurts my fingers.

      Javascript has scope -- it's quite well defined

      Yes, its well defined as being almost pointless, but, yes, you are right it has "scope."

      Object oriented does not mean classes

      Umm, yes it does. You may call them what you wish, but "object oriented" has a definition and means something. Inheritance, polymorphism, etc. Of which, javascript has not.

      Javascript may be a standard, but it is a bad "standard."

    17. Re:Javascript is a disaster by roman_mir · · Score: 1

      just in case... this is /. after all, there is another error there, I should have said

      this.name = name;

      in the first 'Person' function.

      Oh, and with the 'eval' function, you should have the entire contents of that in one line, not split across multiple lines, or use escapes there...

    18. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      Thanks for bringing some facts to this smorgasbord of javascript bashing. Perhaps it's a greatly flawed language, but its features and merits deserve a fair hearing too.

    19. Re:Javascript is a disaster by roman_mir · · Score: 2

      and more :)

      num = 10 + 2 + "2"; - becomes 122

      and the corrected "Person " functions is:

      function Person(name1, gender) {
                      this.gender = gender;
                      this.language;
                      this.name1 = name1;
                      this.toString = function() {
                                      return '' + this.gender + ' ' + this.language;
                      }
      };

      missed 'this.' before 'language' in the 'toString'.

      Oooh well.

    20. Re:Javascript is a disaster by multipartmixed · · Score: 1

      Wikipedia defines "Object-Oriented Programming" as

      a programming paradigm using "objects" â" data structures consisting of data fields and methods together with their interactions â" to design applications and computer programs.

      I know you probably only went to a school which taught Java, and so don't understand that object oriented programming can look like something other than Java, but, in fact, it can. Classical inheritance, polymorphism, etc, are good companions but they do not define the paradigm.

      > Two objects that have always contained numerical values,
      > were assigned numerical values, are treated as strings

      Please explain how you meaningfully assigned numerical values to an object in JavaScript.

      --

      Do daemons dream of electric sleep()?
    21. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      Perl's had eval() (which is "on the fly reflection via evaluation of strings into objects") before javascript ever did.

    22. Re:Javascript is a disaster by roman_mir · · Score: 1

      and I said: 'few languages allow that', didn't I? Also do we have Perl running inside a browser nowadays?

    23. Re:Javascript is a disaster by the+eric+conspiracy · · Score: 1

      Mod parent up some more.

      It may have some of these features, but they are a trap. People talk about it being object oriented and so on, and there are some features that make it look that way, it is a trap that leads you into programming hell.

      Then the fact that every implementation of the language is some variant or another and you need browser specific code in real world Javascript.

      All all of these libraries? They sound nice and all, but when you go to use them you quickly find yourself dropping to low level code to get teh speed.

      In other words I just don't like it.

    24. Re:Javascript is a disaster by lucian1900 · · Score: 1

      So you'd much rather have the language try to evaluate a number inside a string than to promote a number to a string? Perl and C++ are not examples of sane languages.

      You are correct that JS's behaviour isn't correct. It should instead raise an exception if you try to add numbers and strings. It should require you to explicitly cast one to the other first. But JS's behaviour is much, MUCH better than Perl's.

    25. Re:Javascript is a disaster by gbutler69 · · Score: 2

      Two objects that have always contained numerical values, were assigned numerical values, are treated as strings. You always have to explicitly cast them as numbers. Which is bogus. Just the typing alone hurts my fingers.

      Bu-u-u-llshit! Try the following

      var i = 1; var j = 2; alert ( "This is a test : " + ( i + j ) );

      --
      Over-the-top Response Guy! Giving "Over-the-Top Responses" since 1970.
    26. Re:Javascript is a disaster by Paradise+Pete · · Score: 2

      It's not a syntax error. A genuine syntax error would have saved you early. Instead it's a bug waiting to happen. And the only reason it's a bug is that javascript is so effed up. having Global be the default scope within a function is just plain crazy.

    27. Re:Javascript is a disaster by Nursie · · Score: 1

      Pretty sure that inheritance is actually part of the definition of OO, in fact java is not seen as pure OO because it dissalows multiple inheritance.

      but what do I know? I'm just a C programmer...

    28. Re:Javascript is a disaster by jc42 · · Score: 2

      If you think Javascript is weird, try executing this in C: "123"+1

      What's weird about that? It clearly produces a pointer to that '2' in the middle of the quoted string. Isn't that what any sane programmer would expect? ;-)

      One of my favorite C examples is a variant on the above:

      i = 257 & 0x0F;
      c = "0123456789ABCDEF"[i];

      Actually, my main comment about such examples is that, if you can't instantly explain what each is doing (and why the second is safe), I'd be nervous about hiring you for a C project. Unfortunately, most of the people doing such hiring can't explain either of these examples, which explains a lot of why we get so much crappy code from the computer industry.

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
    29. Re:Javascript is a disaster by emj · · Score: 1

      num = 10 + 2 + "2"; - becomes 14

      No that becomes 122.

    30. Re:Javascript is a disaster by t2t10 · · Score: 1

      JavaScript and Self are object oriented, but not class based.

      They are "object oriented" only because they insisted on using that buzzword. It might be reasonable to call them something else.

      But whatever you call it, it doesn't work well. Prototype-based "OOP" seems conceptually simpler, but it ends up being more complicated and harder to maintain in practice. It was a good thing to try, but it's an experiment that has failed.

    31. Re:Javascript is a disaster by roman_mir · · Score: 1

      No, from my perspective it's a syntax error, as I typed that into the HTML text area without an IDE and without double checking.

      Just for the /. types, I double checked and saw a couple of other things that you might have missed.

    32. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      "JavaScript has scopes. A variable declared in a function goes away at the end of the function, same for the body of an if, a loop, etc."

      JavaScript has function scope, but not block scope.

    33. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      ...

      As to the question whether this language has anything that others do not, again, how about on the fly reflection via evaluation of strings into objects? When I first saw that over a decade ago, I thought it was a neat concept then, I still think it's a neat concept today.

      Objective-C kan do that kind of reflection. Check out: http://stackoverflow.com/questions/2331983/objective-c-class-string-like-nsarray-classname-nsarray

    34. Re:Javascript is a disaster by t2t10 · · Score: 1

      No, you did not "make a syntax error", and that is the problem: your code was wrong, but it was syntactically correct. You made a mistake that led to a variable having the wrong scope. Those can lead to extremely hard to find bugs.

      JavaScript's choice that the default scope is global is bad language design. The two choices that actually work are: default local scope or requiring an explicit declaration for all variables.

    35. Re:Javascript is a disaster by Tetravus · · Score: 1

      No scope to speak of

      well, it's not true really. In the following example x will have global scope and y will be local to its function:

      x=2;
      function test() {

          y = x + 3;
      }

      --

      The declaration of the variable 'y' in the example is missing its keyword 'var' and will unintentionally create a globally scoped variable.
      Should be:
      var x = 2;
      function test(){
      var y;
      y = x + 3; // could also place the var statement inline with assignment operator
      }
      console.log(x); // prints 2 to the JS console
      console.log(typeof y); // prints 'undefined' to the JS console

      - well, there is the keyword "inherits" and it does allow an object to be extended and you can use the 'prototype' to have multiple inheritance.

      The prototype inheritance pattern doesn't allow for true multiple inheritance (like what C++ has). However, you can fake it by munging functions from multiple classes into your class' prototype effectively providing the functionality of multiple inheritance in simple cases.

    36. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      * I shake my head.

      Thus speaks a javascript monkey getting all upset. Look... Javascript is lower on the pecking order than Visual Basic. You aren't a coder... you are a web designer whose read a couple of books. Fucking scum basically.

    37. Re:Javascript is a disaster by medoc · · Score: 1

      It is my humble opinion that naming classes "function" is not very helpful... And it's great that javascript has an eval statement, but Lisp (1958?) may claim some prior art here...

      Javascript is a crappy language, up there with PHP. They happened to be at the right place at the right time, which allowed them to gain an extremely wide usage that their intrisic qualities would certainly not warrant.

    38. Re:Javascript is a disaster by Kakihara · · Score: 1

      Someone mod parent down please. How did he ever get modded up? Whether it's trolling or ignorance I need some catharsis so here's a reply.

      The problem with javascript is that it is one of the WORST languages and environments.

      Javascript is not an environment. You're off to a bad start.

      I dare to say Brandan owes the whole industry a great big apology.

      The language was developed to allow scripting in the Netscape browser. The rest of the industry then adopted it. So you're arguing that the industry should apologise to Eich for adopting his language?

      If he were japanese, there is a traditional act he should perform.

      Are you referring to Seppuku - i.e. ritual suicide by disembowelment? This was practised by Samurai to avoid the shame or torture that would ensue from falling into the hands of the enemy in order to restore the honour lost in defeat. It was also sometimes offered as an alternative to capital punishment. I don't think either case applies here. In spite of your half-baked objections, javascript isn't facing imminent defeat. Quite the reverse.

      Javascript doesn't have types to speak of

      Except for numbers, strings, booleans, arrays, and prototypal inheritance.

      doesn't handle numbers very well, I mean seriously "+" appends two numbers?

      WTF? Are you suggesting that 1+2 returns 12 in javascript? It doesn't. "1"+2 and "2"+1 both return "12". That's because in both cases the numbers are implicitly converted to strings - you know, one of those types you don't think are worth speaking of.

      No scope to speak of.

      Except for lexical scope. My guess is you get confused by what "this" refers to in places, e.g. event handlers. I suggest you learn about Function.apply and Function.call.

      It looks object oriented, but has no real notion of classes. No inheritance.

      There's a reason it looks object-oriented - because it is. You believe that classes are a pre-requisite of an object-oriented language. They are not. There absolutely is inheritance, it's prototypal inheritance. I suspect what you mean by "it looks object oriented" is that it looks a little bit like Java. If you think Javascript lacks inheritance you are in no position whatsoever to comment on the language.

      All of the features that have made languages "safer" and "easier" to program in, javascript lacks.

      You've put the words "safer" and "easier" in quotes but given no indication of what you been to imply by their use. The two are often in opposition to each other. Javascript is weakly and dynamically typed. That helps makes it pretty damn easy (for me at least) to get a lot done in it very quickly. There's no type-safety, but there's ease. It has closures, higher-order functions so you can code functionally as well as imperatively. You can use prototypes or ignore them completely. It's rammed full of "features"! What is it lacking that you think it should have?

      Visual Basic is a better language, and I hate VB too.

      It's really not. It's ugly, not concise, and the way it works counters efforts to write concise code. Meaning it's less readable. For example, whereas in javascript and (other) c-like languages you've got the ternary/conditional ?: operator, in VB you've got IIF. Except that with IIF, all expressions get evaluated. That's absurd. Likewise in JS and other c-clike languages you can have: if (anObj != null && anObj.isReady > n) anObj.doSomething(), with theVB equivalent anObj.isRead would get executed regardless of whether or not anObj was Nothing (null). How is that, or any other aspect of VB, better than Javascript?

      But why you're mentioning VB I don't know.

      I shake my head.

      I wish I could too.

      --
      "Has the rule of law degenerated into the rule of lawyers?" (Niall Ferguson)
    39. Re:Javascript is a disaster by roman_mir · · Score: 1

      god, I am tired of you people.

    40. Re:Javascript is a disaster by roman_mir · · Score: 1

      and here is what I told the other guy, who mentioned the same thing.. and the other guy.... and there will be another... /. is great for this reason alone - it's like a place where the memories are gone instantly... the stories are reposted, but so are the same comments, over and over, it's like an obsessive compulsive schizo, it's clear the comments are unnecessary, but he can't help himself.

    41. Re:Javascript is a disaster by roman_mir · · Score: 1

      as I said multiple times in this thread, in my original comment it says: "few languages allow this". Yes, this means there are a few languages, few but there are. What else do you want me to know?

    42. Re:Javascript is a disaster by xero314 · · Score: 1

      Javascript doesn't have types to speak of, doesn't handle numbers very well, I mean seriously "+" appends two numbers? No scope to speak of. It looks object oriented, but has no real notion of classes. No inheritance.

      You clearly know nothing about javascript. JavaScript has types. These types are not dynamic but can be auto-cast using clearly defined rules. JavaScript is fully object oriented. All types are objects, even functions. JavaScript has very clearly defined scope (you use curly brackets to define all scope in JavaScript). With out scope there would be no possibility of closures. And of course JavaScript handles numbers just fine (excusing the standard IEEE oddities that all IEEE compliant languages have). It also handles strings appropriately. If you can't tell the difference between a number and a string then I'm not sure what to tell you.

      The only thing you got right is JavaScript's shining strength, and that is that it does not have classes. JavaScript is not a Classical language, it is a Prototypical language. If you don't know the difference then you probably should not be commenting on Prototypical languages.

    43. Re:Javascript is a disaster by Berfert · · Score: 1

      Even better, imo:

      char c = 1["abc"]; // c = 'b'

    44. Re:Javascript is a disaster by xero314 · · Score: 1

      Then the fact that every implementation of the language is some variant or another and you need browser specific code in real world Javascript.

      This is in no way a fault of JavaScript or even the browsers implementation of JavaScript. This tends to be because of the libraries you might be using through JavaScript, such as the DOM library or other built in browser functions. Those have nothing to do with the language that is JavaScript, though people confuse them a lot. This would happen with any language, as it's up to the browser implementor to implement the libraries. Try using JavaScript in a pure JS interpreter without calling out to other libraries and you will see it works the same on all compliant interpreters.

    45. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      Two objects that have always contained numerical values, were assigned numerical values, are treated as strings. You always have to explicitly cast them as numbers. Which is bogus. Just the typing alone hurts my fingers.

      You were appending two strings whose values contained numbers only. It's annoying, but you were appending two strings. Just run a simple JavaScript "var myVar = 2; var myVar2=2; alert(myVar + myVar2);"

      The alert box (Welcome back, 1990s!) prints out a 3. Once you start putting a string in that alert box, like "alert('My value: ', myVar, myVar2);" you'll get "My value: 12".

      JavaScript order of operations dictates left-to-right. First we have a string. Excellent. Then we have an integer. Damn, you can't add a string and an integer, so JavaScript will coerce the integer to a string and concatenate. So finally we have a string and an integer. It'll coerce the second integer to a string.

      Hot damn, JavaScript did what you told it to. Just because you didn't know how to tell it what you wanted it to do is not necessarily the languages fault. If you want to program in the language, learn the language.

      Object oriented does not mean classes

      Umm, yes it does. You may call them what you wish, but "object oriented" has a definition and means something. Inheritance, polymorphism, etc. Of which, javascript has not.

      Javascript may be a standard, but it is a bad "standard."

      Good lord. No it really doesn't. Can I have the name of your educational institution so I can recommend people not go there? JavaScript is a prototype based object oriented model: http://en.wikipedia.org/wiki/Prototype-based_programming

      I have never seen someone so woefully under-informed on JavaScript. JavaScript has a lot of issues, but the way to address them isn't to spread lies and misinformation.

    46. Re:Javascript is a disaster by the+eric+conspiracy · · Score: 1

      So? It still makes Javascript a giant pain in the butt to use. I don't care who's fault the suckage is, what is important is how it affects my enjoyment of life. Up or down.

      And Javascript is a down.

    47. Re:Javascript is a disaster by OverZealous.com · · Score: 1

      No scope to speak of

      well, it's not true really. In the following example x will have global scope and y will be local to its function:

      x=2; function test() { y = x + 3; }

      Have to correct you here: In JavaScript, ALL variables that are not explicitly declared with var are declared global. It's without question the worst "feature" of JavaScript. In your example, both x and y are global. The correct example code is:

      x = 2; function test() { var y = x + 3; }

      However, like almost all problems with JavaScript, running your scripts through Douglas Crockford's JSLint (and strictly adhering to it) pretty much eliminates that issue. It can be run on the command line as part of a build script, and has really helped me write much better JS code.

    48. Re:Javascript is a disaster by roman_mir · · Score: 1

      Oh, you are just doing this on purpose, aren't you?

      And by the way, none of you, redundant commentators noticed this

    49. Re:Javascript is a disaster by OverZealous.com · · Score: 1

      I can explain it easily: I hadn't clicked "Get More Comments" at the bottom before replying. I apologize for being "redundant" - but when I replied, the original message didn't show any responses. I certainly wouldn't have written in otherwise!

      Don't get too upset! :-)

      It's kinda funny, really. Gotta love the New Slashdot(TM)

    50. Re:Javascript is a disaster by anonymov · · Score: 1

      Yes, that's one of JS design flaws.

      They addressed it only in ES5 strict mode, so you can catch this kind of errors, at least.

    51. Re:Javascript is a disaster by Animats · · Score: 2

      ""+" doesn't append _two numbers_, but it can append _number to string_ In every other language I've seen, the CORRECTly expected result is 11 or error. Perl, C++, etc. The point is that you can never trust your input if you are expecting numeric.

      It's also wrong in Python, in an even worse way. The problem began with using "+" for concatenation. Concatenation works on sequences, so [1,2] + [3,4] in Python is [1,2,3,4], which is not what one might expect. Worse, Python has both sequences and numeric arrays (as part of the standard NumPy math package), and numeric arrays have different semantics. Adding numeric arrays with "+" has numerical semantics - you get a vector addition. Still worse, mixed mode addition between sequences and numeric arrays is allowed. (Discovering the semantics of that is left to the reader.)

      Then this was generalized to multiplication. In Python, "[1,2] * 2" is [1,2,1,2]. Ulp.

      This is a non-trivial design error in Python. Python functions are essentially generic, This allows some functions designed for scalars to generalize to complex numbers and vectors. It's thus quite reasonable for someone to use either a list of numbers or a numeric array as an argument to the same function. That produces unexpected results, often without raising an error exception.

      This is one of the standard language designer errors. The other classic is not putting in a "bool" type at the beginning. Retrofitting one later never quite works right, because mixed-mode integer and bool semantics get ugly. C and Python both retrofitted bool types, and the dents still show. Mathematically, for Booleans, "+" should be OR, and "*" should be AND. If you don't like that, they should be errors. In Python, "True + True" is 2.

    52. Re:Javascript is a disaster by roman_mir · · Score: 1

      here is what I think about modern /. and that's why I turned off the new features and am using classic /. without AJAX.

    53. Re:Javascript is a disaster by rb12345 · · Score: 1

      Also do we have Perl running inside a browser nowadays?

      Only on IE with ActivePerl installed, where you have (optional?) PerlScript.

    54. Re:Javascript is a disaster by timothyf · · Score: 1

      Since when has "+" appended 2 numbers?

      Two objects that have always contained numerical values, were assigned numerical values, are treated as strings. You always have to explicitly cast them as numbers. Which is bogus. Just the typing alone hurts my fingers.

      *fires up Chrome's JS console*

      > var obj = {one: 1, two: 2}
      undefined
      > obj.one + obj.two
      3
      > var obj = {one: "1", two: "2"}
      undefined
      > obj.one + obj.two
      "12"
      > parseInt(obj.one) + parseInt(obj.two)
      3

      Nope, seems to work right to me.

    55. Re:Javascript is a disaster by rubycodez · · Score: 1

      that's a case in point, we can't read all the comments because of all the fucking shitty javascript that's been recently added.

    56. Re:Javascript is a disaster by xero314 · · Score: 1

      By that argument, every language that can be used for DOM manipulation has the same exact problem and there for is a Bad language. This includes C, C++, C#, VB, Java, Python, Ruby... I think you get the point. Don't blame the language for the bad DOM implementation you are using. If you don't like the different DOM implementations then use a library that abstracts the differences away (Like JQuery). Using an abstraction library would be the equivalent to using libc in C to abstract away the differences in native calls. The fact that this kind of abstraction is available is just one of the signs of the strength of the JavaScript language.

    57. Re:Javascript is a disaster by shutdown+-p+now · · Score: 1

      Two objects that have always contained numerical values, were assigned numerical values, are treated as strings. You always have to explicitly cast them as numbers. Which is bogus.

      It's not bogus, it's called "strong typing" (ironically, given that you yourself have complained about it being missing from JS!).

      5 is a number. "5" is a string. They look superficially the same to you, but one represents an integer, and another represents an immutable array of Unicode characters. Therefore, they are different.

      For your convenience, JavaScript overrides operator+ such that, if one of the operands is a string, the rest are also converted to strings and concatenation is performed. This behavior is identical to that of Java and C#, as well as many other less popular languages.

      You may call them what you wish, but "object oriented" has a definition and means something. Inheritance, polymorphism, etc. Of which, javascript has not.

      The definition of "object-oriented" does not include "inheritance" in general, because it is not restricted to class-based languages (note that it is object-oriented, not class-oriented), and inheritance only makes sense when you talk about classes.

      The only real requirements for OOP are the notion of object identity (as something distinct from object state), and subtype polymorphism. JavaScript has both, which is why it is an object-oriented language. All other features (often mistakenly ascribed to OOP in general) - inheritance, encapsulation etc - are language-specific.

    58. Re:Javascript is a disaster by shutdown+-p+now · · Score: 2

      Pretty sure that inheritance is actually part of the definition of OO

      It's not. It's part of definition of class-based OO, but there's also prototype-based OO (which JS belongs to), and other more exotic schemes.

      in fact java is not seen as pure OO because it dissalows multiple inheritance.

      I've no idea where you've got that one from. Java is not seen as pure OO for the sole reason that not all of its values are objects - it also has primitive types such as "int" and "float", values of which aren't objects, which do not participate in type relations etc.

      In contrast, in e.g. Python every int is an object (implementation-wise it's optimized, of course, so writing a literal 123 does not actually allocate anything on the heap), so Python is purely OO.

    59. Re:Javascript is a disaster by mlwmohawk · · Score: 1

      parseInt(obj.one) + parseInt(obj.two)

      And you *think* that is "working?"
      I'm sorry, javascript isn't just a disaster, its also causing wide spread brain damage. To paraphrase a great mind, Javascript is so bad that it isn't even wrong. In your reply, you create a perfect example of why it is so bad. There is no expressly numerical type. There is no "type knowledge" within the object where two numbers would know that "+" means add and not append. Instead, even though you initialized them with clearly numeric data, you can't use them as numbers implicitly. I would even accept assigning a variable "1.0" would cause it to be a string and 1.0 would cause it to be a number, but no, either way you ALWAYS have to cast a number to be a number, which is stupid and error prone.

      For decades a lot of effort and thinking have gone into making programming languages better, yet, javascript, which embodies none of these advances, is what is used on the browser. The problem with discussing why it is broken is that the javascript hostages have learned to love their captor.

    60. Re:Javascript is a disaster by mlwmohawk · · Score: 1

      It's not bogus, it's called "strong typing"

      I'm sorry, having one "type" is not strong typing.

      The definition of "object-oriented" does not include "inheritance" in general, because it is not restricted to class-based languages (note that it is object-oriented, not class-oriented), and inheritance only makes sense when you talk about classes.

      Umm, I'm not sure where you learned how to program, but "object oriented" certainly is all about classes, objects, polymorphism, inheritance, data hiding, etc. Redefining establish terms is not a valid argument style. Jeez, even wikipedia has it right, what's your excuse?

    61. Re:Javascript is a disaster by EoN604 · · Score: 1

      I make the serious assertion that the people who've been raging about JavaScript in this thread (mostly 'Anonymous Coward') actually don't know JavaScript well enough to understand how powerful it can really be. It's style of inheritance (not classical class based) is unusual to get used to, but actually very powerful. I can honestly say I only know a few developers who I'd consider 'experts' in JavaScript. The high majority of web developers do not have a thorough understanding of it.

    62. Re:Javascript is a disaster by shutdown+-p+now · · Score: 1

      I'm sorry, having one "type" is not strong typing.

      Strong typing is when values have exactly one well-defined type, which defines their behavior. In my example, the value "5" has type string, and the value 5 has type number. This is obvious from the fact that their behavior is different - namely "5"+"5" gives "55", and 5+5 gives 10. So that's at least two types.

      A language where "5"+"5" gives 10, and "5"+"a" gives "5a", is not strongly typed, because in it the value is treated either as a string or as a number, depending on potential interpretations in any given context.

      Umm, I'm not sure where you learned how to program, but "object oriented" certainly is all about classes, objects, polymorphism, inheritance, data hiding, etc. Redefining establish terms is not a valid argument style. Jeez, even wikipedia has it right, what's your excuse?

      It's funny that you mention Wikipedia, since, apparently, you haven't bothered to check it yourself, or else your grasp of English isn't so good. Let me quote it for you:

      Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance.

      Note particularly the word "may". Nowhere in this definition it is required for an object-oriented language to have classes, inheritance, encapsulation etc - only that those are features that may be included by such languages.

      Speaking of "redefining established terms" - it may come as a surprise, but OOP is not a well-defined term. The exact phrase was first used by Alan Kay to describe the semantics and methodology of Smalltalk, and the main focus in his definition was on objects and message passing between them, not on classes and inheritance. In any case, Simula-67 - the language which invented the notion of OOP "class" as a language feature - predated Kay's definition; yet it is considered object-oriented today. This is because the definition was vague to begin with, and was adapted to correspond to new developments as time passed. It was never rigorously defined.

      The only place where OOP is an "established term" is in bad Java textbooks, which usually define it as "abstraction, polymorphism, inheritance, and encapsulation", and various courses (including, unfortunately, university courses) which use such textbooks. Most people who only know this definition couldn't properly explain it, as their understanding of underlying concepts such as e.g. "polymorphism" are tied to the specific language; they have no idea that it is a term much broader than OOP, and, in fact, OOP polymorphism is a very narrow subtype of the more broader mechanism which include things such as parametric polymorphism (which has nothing whatsoever to do with OOP).

      This definition can be helpful for a person who is only starting to learn, in a same way that you "lie" to people studying math that e.g. taking a square root of a negative number is an undefined operation - which, for them, it is, until they learn about imaginary and complex numbers. It's a necessary lie to avoid complicating the picture early on, but it's a lie nonetheless. Same with "abstraction, polymorphism, inheritance, and encapsulation".

      Now, judging by your comments, you have "learned to program" from one of those textbooks, or one of those courses. I would strongly recommend you to broaden your horizons by learning a few programming languages that depart significantly from the model that are familiar with. Then you will realize just how narrow your original perspective was.

    63. Re:Javascript is a disaster by anonymov · · Score: 1

      >> typeof 1.0
      number
      >> typeof "1.0"
      string
      >> typeof (1.0+2.0)
      number
      >> typeof ("1.0"+"2.0")
      string
      >> ["1"+1+1, "1"+(1+1)]
      111, 12

      You obviously don't know what are you talking about.

    64. Re:Javascript is a disaster by mlwmohawk · · Score: 1

      The only place where OOP is an "established term" is in bad Java textbooks

      sigh, I'm sorry, the only word I can come up with is ignorance. Where do you think java came from? Or C++ before that? The concepts of "object oriented design" have been around for decades are are not language specific.

      Look up Grady Booch. Follow all the links. Object Oriented Design is type of design, not a feature of a language. Most languages can be used to implement a good object oriented design, javascript can not. Do not try to redefine decades of work for a crappy ass web script.

    65. Re:Javascript is a disaster by mlwmohawk · · Score: 1

      Yes, 1.0 vs "1.0" is pretty obvious, however, if you want to assign an object a value of 1.0 or "1.0" the object should understand the type of data it contains. It does not. Adding two objects which have been assigned 1.0 do not result in 2

    66. Re:Javascript is a disaster by shutdown+-p+now · · Score: 1

      sigh, I'm sorry, the only word I can come up with is ignorance. Where do you think java came from? Or C++ before that?

      The answer to that question was in the post you've replied to. Both Java and C++ came from Simula and Smalltalk.

      The concepts of "object oriented design" have been around for decades are are not language specific. Look up Grady Booch.

      Now you're confusing "object-oriented design" with "object-oriented programming". OOP is a feature of the language (or rather, a certain combination of traits exemplified by language features).

      The irony is that "design" came out of "programming", not the other way around. Simula and Smalltalk have been doing OOP for years before Grady Booch wrote "Object Oriented Analysis and Design" (or do you seriously think that OOP came out of Booch's work?). And OOD only ever concerned itself with class-oriented OOP, and not the entire spectrum.

    67. Re:Javascript is a disaster by mlwmohawk · · Score: 1

      I'm assuming from your reasonable tone, you are a reasonable person. This is slashdot, so I may be mistaken. :-)

      Javascripts proponents, for some reason I can not understand, accept the languages copious short comings as a matter of fact. Even you made the twisted argument that inheritance is "not classical class based," and I don't even understand what you are trying to say. You can't inherit in any reasonable terms, you can implement on a class by class basis manually, but the language is actually hostile to the practice.

      More over, the concepts of "object" and "method" have been conflated. Its the wild wild west, there are no rules, there is no enforcement of anything. It just fails.

      I would think in 2011, languages would be better than this nonsense.

    68. Re:Javascript is a disaster by anonymov · · Score: 1

      > if you want to assign an object a value of 1.0 or "1.0" the object should understand the type of data it contains

      Oh, it does understand alright - 1.0 is of type 'number' and "1.0" is of type 'string'. If you don't see the difference between these - you should be removed from any programming-related activities as quickly as possible.

      Really, you think interpreter should try parsing each and every string for you?

    69. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      num = 10 + 2 + "2"; - becomes 14

      No it doesn't. It becomes string "122". My Firebug console confirms this.

    70. Re:Javascript is a disaster by maraist · · Score: 1

      Your opinion v.s. mine I guess. One of Perl's mottos is to minimize surprise. Both perl and JS polymorphically convert from int to string and back. Don't believe me?
      x="5"
      y=x/2
      y == 2.5

      So JS 'smells' like it wants to do polymorphic base data-types.. But it fails miserably to be consistent. Numbers are more useful than strings (my opinion I guess), so if you've bothered to convert from a string-space to double/integer space, it makes little sense to squash it back to string-space. Now in perl, string space operations are generally explicit "$x", thus all the 'magic' tends towards converting into integer space.. Most other languages make it harder to convert into string space, so I can see why JS made the fateful decision - both JS and Perl are essentially string-centric languages, but without trivial string generators, the only convenient operator JS had was '+'. So basically if any rval is a string, the whole operation is overloaded to string conversion.

      Really, I'm just lamenting the lack of optional data-types (scala, etc). In perl, we could say
      sub foo($$) { use int; return $_[0] + $_[1]; }

      Not that this is beautiful code or anything, but the datatypes are coorseable as a compiler-flag is the point. Technically, JS is JIT'd these days, so
      function foo(x,y) { return Number(x) + Number(y); }
      is plenty fast - just reads funny (yes, I know the perl was nastier in comparison, but there are more elegant blocks of long-spanning functions where these sorts of auto-stringification can accidentally be introduced - namely function-returned-values).

      --
      -Michael
    71. Re:Javascript is a disaster by roman_mir · · Score: 1

      And this thread confirms that /. is schizophrenic.

    72. Re:Javascript is a disaster by roman_mir · · Score: 1

      I am pretty sure 'fucking shitty' code can be done in any language. As to /. - do what I did, go back to classic view and get rid of AJAX calls.

      (Account, Discussions, Classic Discussion System (D1))

      and
      (Options, Simple Design)

    73. Re:Javascript is a disaster by ltmon · · Score: 1

      You're entitled to your own opinions on javascript -- I'm not a huge fan myself, although I see some of it's utility, especially the proper use of first-order functions a-la List or Scheme.

      Your original post, however, and many since, have contained glaring factual inaccuracies. At least try to understand the language structure and design before making an argument to whether it's good or not. There are much better critiques if you're determined to hate it.

      Having operator overloading and type inference does not mean "no types to speak of" or "+ doesn't work". It means that there's a design decision about the language -- you may not like it and plenty don't, but it's hardly uncommon either. I really don't think you have vars "containing numerical values, were assigned numerical values, are treated as strings". At some stage you put a string in the variable, 1 + 1 still equals 2 in javascript. "1" + 1 does not.

      It's been explained about 20 times that having classes is not the same thing as being object oriented. Here's a better and more complete explanation from Douglas Crockford (one of the people who have contributed to this "one man hack" via ECMA).

      http://www.crockford.com/javascript/inheritance.html

      The first couple of sentences are especially relevant:

      "JavaScript is a class-free, object-oriented language, and as such, it uses prototypal inheritance instead of classical inheritance. This can be puzzling to programmers trained in conventional object-oriented languages like C++ and Java."

      Says it all.

    74. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      x=2;
      function test() {
              y = x + 3;
      }

      Actually, both x and y have global scope. Perhaps you meant "var x" and "var y"?

    75. Re:Javascript is a disaster by Asm-Coder · · Score: 1

      i = 257 & 0x0F;
      c = "0123456789ABCDEF"[i];

      I'm actually a little confused by this... maybe it's just a typo?
      257d == 100000001b
      so:
      257 & 0x0F == 0000 0001b == 1d == 0x01

      Which I assume is the wrong result. (I'm pretty sure we are trying to get a pointer to the character 'F' in the string.

      Also, I'm guessing the reason why this is supposed to be 'safer' is because had you used 255 instead of 257, you would guarantee that i would only be a byte long. Except that with a 16 character string, any values of i larger than 15 (00001111b) are invalid, so in order to prevent c from pointing someplace beyond the end of the string, which is what I think your goal was, the code should be:
      i=15 & 0x0F;
      c="0123456789ABCDEF"[i];

      But maybe I misinterpreted what you were trying to do.

    76. Re:Javascript is a disaster by matthewv789 · · Score: 1

      While this point of view was quite popular 5-10 years ago, now it just betrays your ignorance. We know better now. Douglas Crockford has been the most active promoter of a more mature understanding of Javascript: http://javascript.crockford.com/

      Some of Javascript's repuation is, like PHP's, historical baggage based on immature early versions that lacked features or had bugs which have since been corrected.

      But the real problems with Javascript are threefold:
      1. Being embedded in the browser, it can only operate on the elements the browser provides; since those elements differ from browser to browser, the naive assumption is that it is the language (or at least its implementation) causing these differences.
      2. Javascript may appear to be a simplified version of Java, but it's not. Crockford contends it is "Lisp in C's clothing". Most professional programmers know Java-like languages much better than Lisp, so they don't really understand Javascript's power and elegance,
      3. Most people writing Javascript aren't even programmers, and those that are, are often not very good ones. While this is not unique to Javascript at all, it is certainly the case that a good chunk of the Javascript in existence is of the form of "knew just enough of the language to use it in the worst possible way". (This is often true of PHP, COBOL, and many other language as well - the easier to use and more accessible the language is, the more likely this is the case.)

    77. Re:Javascript is a disaster by roman_mir · · Score: 1
    78. Re:Javascript is a disaster by narcc · · Score: 1

      Now you're confusing "object-oriented design" with "object-oriented programming". OOP is a feature of the language (or rather, a certain combination of traits exemplified by language features).

      These arguments are hilarious because of comments like this. (I'm not picking on you specifically. There are better examples in the thread, but yours was last.)

      Anyhow, neither term is formally defined, er, that is, in any way which is generally agreed upon.

      Ugh, that was terribly unclear. Suffice it to say that pedantry here is not only unwarranted, it's impossible.

    79. Re:Javascript is a disaster by shutdown+-p+now · · Score: 1

      Anyhow, neither term is formally defined, er, that is, in any way which is generally agreed upon.

      True, which is what I have been saying all along. However, there are quite workable informal definitions!

      For OOP, you basically look at languages which are considered OOP by concensus, and identify the common features. This is precisely how I arrived to the definition of OOP that I gave earlier in the thread, which makes it distict from "mere datatypes": it requires the concept of object identity, and it requires subtype polymorphism (where subtyping can be structural). I'm not aware of any language that would not satisfy those that it still considered object-oriented - if you do, please share it. On the other hand, it allows for languages as diverse as Java, C++, Smalltalk, JavaScript, Python, OCaml, Common Lisp (CLOS), JavaScript and Self. My humble claim, therefore, is it this definition is what is used in practice, even if people don't normally use it consciously (they just pattern match new things against other OOP stuff they know).

      OOD, as the name says, is about design, not development. It's not a language thing at all, but rather a software architecturing methodology (or rather a number of subtly different methodologies, each claiming the title) - briefly summed up as "UML and stuff". There's plenty more handwaving there compared to OOP (which is "I know it when I see it" kind of thing that most people tend to agree on), but the reason why I said that it mostly concerns itself with concepts coming from class-based OOP (rather than prototype-based) is because I'm not aware of any examples that show otherwise. Booch - who is one of the most prominent popularizers - certainly never did focus on JavaScript and the likes, and his methodology revolves around classes. Again, if you have any counter-examples, please share.

    80. Re:Javascript is a disaster by badkarmadayaccount · · Score: 1

      Unfortunately, when JS had so much power vested in it, no one taught it responsibility, just like C/C++. Frankly, I think JS is an all round great language, though it needs DbC primitives like Eiffel, optional bit-twiddling and optional ALGOL syntax like Ada, and the most basic synchronization primitives - singleton type class, atomic vars, anything - it more than powerful enough to implement a nice parallelism framework in a lib.

      --
      I know tobacco is bad for you, so I smoke weed with crack.
    81. Re:Javascript is a disaster by Millennium · · Score: 1

      I'm sorry, having one "type" is not strong typing.

      If every variable or slot is aware of its type, either at compile-time or at run-time, then yes, it is strong typing. The type-awareness is what matters, not whether types are checked at compile-time versus runtime.

      You, like many people, have confused strong/weak typing with static/dynamic typing. The concepts are actually orthogonal. Static/weak languages exist (like C), as do dynamic/strong languages (like Python and, yes, JavaScript). So, of course, do static/strong languages (Java, Pascal) and dynamic/weak ones (PHP, most assembly languages).

      There's more to programming than Java and "languages that suck." You really need to learn more about what's out there.

    82. Re:Javascript is a disaster by Millennium · · Score: 1

      Umm, I'm not sure where you learned how to program, but "object oriented" certainly is all about classes, objects, polymorphism, inheritance, data hiding, etc.

      Nope. Object-oriented programming is about objects and polymorphism, full stop. All else -classes or prototypes, interfaces versus one of the many forms of inheritance, and so on- is a matter of implementation detail: no more, no less. Data hiding isn't even OO-exclusive, and is valuable mainly insofar as it can aid polymorphism.

      I realize your CS teacher/professor may have told you something else: in fact, they probably did. But computer science has moved on, and it has evolved in some very interesting ways. It might not be a bad idea to take some time getting your skills up to date.

    83. Re:Javascript is a disaster by Anonymous Coward · · Score: 0

      Nope. Object-oriented programming is about objects and polymorphism

      As defined by whom?

      I realize your CS teacher/professor may have told you something else: in fact, they probably did.

      So, the "Computer Science" definition of "object oriented design" as published in text books, instructed in school, and generally held by most experienced professionals isn't? Again, according to whom?

    84. Re:Javascript is a disaster by Nursie · · Score: 1

      Interesting, never heard of prototype based OO before. It sounds very haphazard and javascript-ish though from what I've now read.

      Meh, I'm not even involved in classes. Good ol' C is good enough for me :)

    85. Re:Javascript is a disaster by shutdown+-p+now · · Score: 1

      Interesting, never heard of prototype based OO before. It sounds very haphazard and javascript-ish though from what I've now read.

      It probably does, because JS is the only mainstream language which uses it. So the approach kinda gets conflated with the language.

      That said, it kinda makes sense when your language is inherently dynamically typed, where the notion of class is not as important as it is in statically typed system. It takes the notion of "class is an object" one step further - there are no classes, there are just objects. One less concept to deal with,

      Meh, I'm not even involved in classes. Good ol' C is good enough for me

      My personal experience with large bodies of C code has led me to formulate a rule not dissimilar to Greenspun's one about Lisp; namely, that an "any sufficiently complicated C program contains an ad hoc, extremely verbose and type-unsafe implementation of half of C++ object system". A classic case in point is Gtk+, or, more specifically, GObject. But somewhat OO-ish structures can be seen even in the Linux kernel. Basically, whenever you see structures with a bunch of fields of function pointer types, that's OOP smell - real men write switches instead ;)

    86. Re:Javascript is a disaster by Nursie · · Score: 1

      "any sufficiently complicated C program contains an ad hoc, extremely verbose and type-unsafe implementation of half of C++ object system"

      You're probably not wrong there!

      In my experience you can certainly end up (pretty quickly) with structs representing input/output interfaces and function pointers for common methods with different implementations.

      Doesn't always go that way though. One way people often avoid it is through the use of callbacks, and even stacks of callbacks. I can't quite wrap my head around how those two things replace each other right now (error: not enough coffee) but it seems you usually get one or the other.

    87. Re:Javascript is a disaster by jc42 · · Score: 1

      Nah; your result was correct. The example is a simplified version of a single step in the conventional code to produce a string that's the hex value of an int. It uses 0x0F to pick off the low-order 4 bits of the value (which should be an input variable rather than 257), and uses that 4-bit value as an index into the string of hex digits. This gives a printable char, which is saved somewhere. Then the input value is shifted right by 4 bits, and the process is repeated, until the input value is zero or some fixed number of chars have been produced, whichever you want.

      The "tricky" part to the example is that most people not familiar with C don't understand that a quoted string is just an array of chars, and can be indexed like any other array. Most languages would call that subscript operation a syntax error, but in C, you can use anything that is logically an array, indexed by anything that can be converted to an int. This can result in more compact code that is quite readable to an experienced C programmer, but possibly upsetting and mind-bending to people coming from other languages.

      As someone else pointed out, and is mentioned in the "C bible" and assorted other C manuals, the subscript operation in C is in fact commutative. It's just the result of indirecting on the sum of a pointer and an int (multiplied by the size of what the pointer points to). The second statement can be, clarified by translating it to "c=*("0123456789ABCDEF"+i)", which is logically equivalent to the version with brackets. The quoted string is of type (char *), so the expression is simply an add and a load of a byte from the resulting address.

      The reason for calling this example "safe" is that masking the input value (257) with 0x0F guarantees that the index is within the [0-15] range, and the index operation can't be out of bounds. No bounds checking is one of the favorite criticisms of C. But in this case, a compiler that generates a bounds check is simply wasting both memory and cpu time, since the index is provably in bounds. And the bounds-check code in other languages isn't any faster than what any competent C program can explicitly program when it's necessary. So if you have a competent programmer, C is no more dangerous than other languages, and it's often faster (when the bounds check is unnecessary). But C programmers can still complain that they're being forced to waste human time doing a compiler's job for a tiny saving of cpu time.

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
    88. Re:Javascript is a disaster by t2t10 · · Score: 1

      Yes, and at this rate, JavaScript will be a decent programming language by the time this year's college graduates retire :-)

    89. Re:Javascript is a disaster by timothyf · · Score: 1

      I think you've been inhaling a bit too much PHP. Just because Javascript is dynamically typed (and it's not alone in this respect, many interpreted languages are), doesn't mean the types are irrelevant. Sure, Javascript will coerce types sometimes, but it's pretty logical about it once you understand how it works. The only real complaint I have is overloading + for string concatenation as well as addition.

      What you're asking for is an object that will coerce its inputs, which you can do, you just need to follow good programming practices--mainly, never allow public access to an object's members. If you use getter/setter functions, you can explicitly coerce your types once in the object and then everywhere you use it you no longer have to worry about it. It's standard OO best-practices. http://ejohn.org/blog/javascript-getters-and-setters/ is a good place to start to explore that in JS.

      Programming languages have never had "reads the programmers mind" as a feature.

  8. Readability by Timmmm · · Score: 2

    When did it become acceptable to have the content take up only 1/4 of the page width?

    1. Re:Readability by Inda · · Score: 1

      1/6 of the screen here.

      The blank areas are probably full of adverts. ;p

      --
      This post contains benzene, nitrosamines, formaldehyde and hydrogen cyanide.
    2. Re:Readability by game+kid · · Score: 1

      Content? Content!? Don't you get it? Internet is the new TV, and it needs more 2-hour-long commercials for Coca-Cola, Ford, and Bing. Who cares who wins? It's all about who fights, who's dating, and who's the 1,000,000th page view (CLICK HERE to claim your prize!).

      --
      You can hold down the "B" button for continuous firing.
    3. Re:Readability by tenco · · Score: 1

      Ever saw a newspaper in your life? TFA has ~ 60 characters per line, which is perfectly readable.

  9. The community is worse than the language. by Anonymous Coward · · Score: 2, Interesting

    While the JavaScript language, development environments and implementations are absolutely terrible, as I see you're well aware, those are not the worst parts of it all. By far, the community is the most atrocious thing related to JavaScript. The people are generally nice enough, but my gosh, are they ever ignorant when it comes to computing.

    JavaScript tends to drive away everyone who is even remotely a good programmer, as such people can usually see just how flawed JavaScript is, and they want nothing to do with it. So what we have left over is a bunch of non-skilled "programmers" who think they know what they're talking about, but in reality have absolutely no clue. They continually produce some of the shittiest code that has ever been written.

    The scariest part is how they want to start getting involved with server-side development. This was typically one area of web development were good developers could use good technologies to get the job done well. But now the JavaScript community has put together very half-assed Erlang clones like Node.js, and have been hyping them as viable server-side technologies (when they clearly aren't). This is going to be a huge disaster, caused solely by the ignorance of the JavaScript community, and those who are foolish enough to hire such people to develop software.

    1. Re:The community is worse than the language. by lucian1900 · · Score: 1

      Fortunately, you're mostly wrong.

      JavaScript isn't quite so bad as you make it out to be. It's much better than C++, Java or PHP, and there is a lot of good software written in each of those. Its flaws are mostly due to incompleteness, and that can be fixed with libraries and compilers (CoffeeScript).

      node.js has nothing to do with erlang. It's much more similar to Python's Twisted and, barring the lack of good JS libraries, is quite good.

      I understand your hatred towards JS, but there are much better targets out there for such mindless hatred

    2. Re:The community is worse than the language. by Anonymous Coward · · Score: 0

      That's why GWT was invented...

    3. Re:The community is worse than the language. by Anonymous Coward · · Score: 0

      Really, the abomination that is PHP doesn't convince you otherwise on that last point? Node.js is at least consistent by comparison.

    4. Re:The community is worse than the language. by FreakyGreenLeaky · · Score: 1

      much better than

      Written with such authority, JS must be much better then...

    5. Re:The community is worse than the language. by Undead+Waffle · · Score: 1

      JavaScript tends to drive away everyone who is even remotely a good programmer, as such people can usually see just how flawed JavaScript is, and they want nothing to do with it. So what we have left over is a bunch of non-skilled "programmers" who think they know what they're talking about, but in reality have absolutely no clue. They continually produce some of the shittiest code that has ever been written.

      Combine that with a healthy dosage of fanaticism and allow me to introduce you to the LabVIEW community... and I'm sure they can make you rethink that "shittiest code that has ever been written" part.

    6. Re:The community is worse than the language. by Anonymous Coward · · Score: 0

      Fortunately - indeed, he's not wrong.

      What's the point to squeeze a client-side DOModelling language into servers?
      Sorry, but I can't see any benefit.

    7. Re:The community is worse than the language. by Anonymous Coward · · Score: 0

      You can start programming Javascript as if it is a procedural language, which makes one end of the learning curve remarkably shallow. The problem is that some people stop there. The beauty of Javascript is that it is LISP in C's clothing, which makes it incredibly powerful. I would highly recommend reading "Javascript: The Good Parts" by Douglas Crockford (http://oreilly.com/catalog/9780596517748) before condemning the language.

  10. Javascript might be in *it's* most important time by plaukas+pyragely · · Score: 1

    ..but in no way it's the most important programing language of all.

  11. Continual tinkering: required? by Compaqt · · Score: 1

    Isn't Javascript flexible enough to let programmers define their own programming styles without the need to tinker with the language proper?

    It seems to me most of the innovation in the Javascript space is taking place in libraries/frameworks (like jQuery, Dojo, Scriptaculous, Prototype, YUI, GWT and so on), as it should.

    What will the point of some new syntax be?

    --
    I'm not a lawyer, but I play one on the Internet. Blog
  12. Perfect example of popularity over quality by Anonymous Coward · · Score: 1

    I hate Javascript. I've hated it since the early days of the web when I saw that it was just a half-assed scripting version of real C-syntax programming languages (take your pick on which one). Web programming is much more complicated than it needs to be due to the combination of a crappy client-side programming language (Javascript, I'm looking at you) and a presentation layer that was never designed to support software (that's HTML lurking in the corner). These two are the foundation of every standard web app made today. The world has evolved this way because they are the least common denominator technologies and because they were easy for the script kiddies who grew up to be today's web programmers.

    1. Re:Perfect example of popularity over quality by Lennie · · Score: 2, Insightful

      Most of what is bad about JavaScript isn't so much the language, but the environment. People still drag their IE6 on to the internet and they expect things to work and it seems many website builders try to oblige them. They work around the problems in that 10 year old software. Many things have changed since then.

      I do not know what you do, but let's say you are a Java programmer, when you code do you always keep in the back of your mind it should still work on the 1.3 runtimes from 10 years ago ? And do you check/test it too ?

      If you are a C-programmer developing programs which run on Linux, you always create 2 code paths ? One which compiles and runs on Linux 2.2.x/gcc 2.95.x ? And some #ifdef where you take advantage of the newer features which Linux and other modern operating systems offer you ?

      Or do your programs still compile against the libraries of KDE3 ? QT from before 3.0 ? Or the GTK1.2 ? And do you test this ? And regularly ?

      So yes, there is some cruft. That doesn't mean the newer stuff can be exciting to people.

      The HTML5 and other new specifications has a lot of good things in it, the WHATWG was specifically created to create a new specification for creating applications, which has now grown into the HTML5-specification as it is now. JavaScript it self has some really interresting properties.

      --
      New things are always on the horizon
    2. Re:Perfect example of popularity over quality by Lennie · · Score: 1

      I could also ask you something else: do you think you could have created something better in 10 days ? That is the time it took Brendan Eich to create something from scratch, 10 days from doing to language design to a working and shipping version.

      --
      New things are always on the horizon
    3. Re:Perfect example of popularity over quality by Chelloveck · · Score: 1

      If you are a C-programmer developing programs which run on Linux, you always create 2 code paths ? One which compiles and runs on Linux 2.2.x/gcc 2.95.x ? And some #ifdef where you take advantage of the newer features which Linux and other modern operating systems offer you ?

      Yes. You know that "./configure" command which is the first step in building 99% of the source code packages out there? Guess what that's doing. Setting up a bazillion different #defines to adapt code to different platforms, architectures, compilers, and libraries. Any significant C project which tries to be in the least bit cross-platform has a lot of code devoted to ironing out the wrinkles.

      --
      Chelloveck
      I give up on debugging. From now on, SIGSEGV is a feature.
    4. Re:Perfect example of popularity over quality by Anonymous Coward · · Score: 0

      Maybe he should have taken a little longer than 10 days.

    5. Re:Perfect example of popularity over quality by Lennie · · Score: 1

      I think the creator of JavaScript came from Silicon Graphics and they (Netscape) needed him to release something in that timeframe. At the time they probably didn't expect it to be important. Microsoft took that project and reverse engineered it exactly (better than anything else Microsoft ever copied or implemented a specification, before that point and after that point) and made it bug for bug compatible. Thus you had 2 implementations in the market and it couldn't be easily changed anymore.

      --
      New things are always on the horizon
    6. Re:Perfect example of popularity over quality by shutdown+-p+now · · Score: 1

      The language is frankly pretty bad also, if you compare apples to apples, i.e. dynamically typed "scripting" languages. If you compare JS to, say, Ruby or even Python, the latter win on being more feature rich, not having stupid features (function-level scope in a language with blocks - WTF?), and generally being more concise and yet more readable (JS is a language which took the terse C syntax and then added the abomination which are its insanely verbose function literals... gah).

      But it all doesn't really matter. JS is where it is today because it happened to be in the right place at the right time - like most other things in our industry. C is far from a perfect language itself from PL design standpoint, but no-one seriously thinks of replacing it today. I suspect we're in the same boat with JS now... the best we can do is evolve the language to purge most of the nasty bits in it, and streamline the syntax. Which is, in fact, what they're already doing.

      Once it gets short form for anonymous functions, destructuring assignment, block-level scope, and a standardized way of doing classes (which are all considered as part of Ecma TC39), it will become a decent language on par with others in this class. And then there are other nifty things, such as "await". Just give it a little bit more time.

    7. Re:Perfect example of popularity over quality by Lennie · · Score: 1

      It was intended as a scheme syntax (I think it was), but they thought that no one was familair with it so that is why it got the C syntax.

      --
      New things are always on the horizon
    8. Re:Perfect example of popularity over quality by shutdown+-p+now · · Score: 1

      I've heard various theories about the original JS syntax. We may never know, since it was Java-lookalike from the first public releases.

      That said, I find it hard to believe that it could possibly be Scheme (or Lisp in general), because that doesn't mesh at all with JS function-level scope. Nor could it be something that was added when it was replaced by Java syntax, as Java always had block-level scope.

    9. Re:Perfect example of popularity over quality by anonymov · · Score: 1

      There's one point I'd disagree with:ÂI don't see how "being more feature rich" on par with Ruby/Python would be a good thing for embedded language â"Âmost features come at a price and Ruby is an example how language overloaded with features can make the runtime nearly impossible to be not sluggish and memory hungry.

      Also, what makes me sad is the fact that all those improvements to JS are too late for browser JS :( Hopefully server-side JS has some future.

    10. Re:Perfect example of popularity over quality by shutdown+-p+now · · Score: 1

      There's one point I'd disagree with:ÂI don't see how "being more feature rich" on par with Ruby/Python would be a good thing for embedded language â"Âmost features come at a price and Ruby is an example how language overloaded with features can make the runtime nearly impossible to be not sluggish and memory hungry.

      Many features are really just syntactic sugar for some more basic features. It's just that it can be very expressive and convenient syntactic sugar. But you don't really pay any more for those than you'd do if you wrote the equivalent code manually.

      Can you give some examples of features that make Ruby runtime "impossible to be not sluggish and memory hungry", which aren't in JS? The only thing I can think of in this context is call/cc, which is indeed hard to do right, which is why they threw it out in Ruby 1.9. What else?

      Also, what makes me sad is the fact that all those improvements to JS are too late for browser JS

      Why? Browsers update very fast today, even IE bit the bullet. There's no reason why JS development cannot work the same as HTML5/CSS3 development is going now - many small incremental updates, as the spec is developed, such that you get 90%+ feature coverage in most browsers by the time final draft is approved.

    11. Re:Perfect example of popularity over quality by Lennie · · Score: 1

      Do you know JavaScript ? I know it is misleading, but have a look here:

      http://javascript.crockford.com/javascript.html

      --
      New things are always on the horizon
    12. Re:Perfect example of popularity over quality by shutdown+-p+now · · Score: 1

      Yes, I do know JavaScript. What was your point?

      Calling it "Lisp with C syntax", as the linked article does, is very deceptive. Just because the language has first-class functions and closures, it doesn't make it a Lisp, as those are not what set Lisp aside from everything else. Vast majority of modern programming languages have those two features. Heck, even C++ now has them, and it is most definitely not Lisp.

      In any case, the link does not say anything about the history of JS syntax - in particular, no specific claims that it originated as Lisp.

    13. Re:Perfect example of popularity over quality by Lennie · · Score: 1

      Maybe you would like to listen to him tell people about the history:

      http://www.livestream.com/etsy/video?clipId=pla_1463e546-47ed-4a93-b59a-bd52b236e8b8

      The talk starts at 1:30
      He starts to explain the history at about 4:48

      --
      New things are always on the horizon
    14. Re:Perfect example of popularity over quality by shutdown+-p+now · · Score: 1

      He does mention Eich suggesting to Netscape that they use Scheme for a scripting language, but that this was explicitly forbidden, so he had to write it from scratch.

      In terms of language influence, he correctly notes that JavaScript takes syntax from Java (per directions from management), and ideas from Scheme and Self. For Scheme, he specifically only mentions "functions as first-class objects with lexical scoping" (i.e. closures). As noted, this is not a Scheme-specific feature, and, indeed, Self - the influence of which on JS is definite and very major, as it's where prototypes unambiguously come from - also has them, being a derivative of Smalltalk. At the date, there were numerous other languages just as popular as Scheme (which is to say, not much, outside of academia) which also had them - Smalltalk, as already noted, but also ML family.

      Now, I won't try to guess where Eich got the idea - it could well be from Scheme rather than Self or any other language. My point is that it doesn't really matter, because it alone does not make the language "Scheme with Java syntax" or anything special like that. It's just a language feature. It was fairly unusual for a mainstream language back in 1995, but today almost everyone has it, and many have it done better (e.g. compare the verbosity of JS lambdas - function(x,y) { return x+y; } - with Ruby or Haskell or C# - (x,y) => x+y).

    15. Re:Perfect example of popularity over quality by badkarmadayaccount · · Score: 1

      And that is why C is more fucked up then JS will ever be - who the hell forgot to add a decent build control system in the language - preferably using the same tokenization. And is it just me, or do C compilers have more quirks than the average browser?

      --
      I know tobacco is bad for you, so I smoke weed with crack.
    16. Re:Perfect example of popularity over quality by Lennie · · Score: 1

      At the end of the day, only JavaScript is in the browser by default and the rest seems to getting less attention and only used as 'a fallback' for things where HTML/JS/CSS hadn't found widespread adoption, like video (mostly Flash).

      --
      New things are always on the horizon
  13. Wait until you fix your first Node.js disaster. by Anonymous Coward · · Score: 5, Insightful

    Just wait until you've had to fix your first Node.js and MongoDB disaster. I'm working with one client to get rid of such a system. It is by far one of the worst gigs I've ever had, and I've had to clean up a whole lot of stupid shit before.

    JavaScript barely works as a client-side scripting language, and even then the experience is totally shitty for developers and users alike. Slashdot is a really good example of how JavaScript can absolutely fuck up a site unnecessarily.

    But it has absolutely no place for server-side development. It's just not up to the task in any way. It's missing basic language features necessary for large-scale server-side development. Its development tools are atrocious. Its runtime performance is horrible. Node.js is fucking stupid, and that's putting it nicely. Using it to query a data store is an extremely idiotic idea. All in all, it's a massive failure.

    JavaScript "programmers" have put together some of the worst and most broken systems that I've ever dealt with, and I've been dealing with horrible systems written using languages like PHP, Visual Basic, PowerBuilder and Perl. JavaScript may be one of the biggest computing disasters of all time.

    1. Re:Wait until you fix your first Node.js disaster. by Anonymous Coward · · Score: 2

      here here! had similar experiences in my career - completely agree.

    2. Re:Wait until you fix your first Node.js disaster. by thetoadwarrior · · Score: 1

      I believe you should read this.

    3. Re:Wait until you fix your first Node.js disaster. by Anonymous Coward · · Score: 1

      I don't know that it's any less suited than the likes of Ruby or Python for server-side or application development, which both seem to be very popular in the development community. A lot of the issues with dynamic languages tend to come down to how meticulous a developer team is in establishing and following best practices. I've seen plenty of code bases in more mature languages and platforms that don't play out as well.

      MongoDB in particular is primarily a map/reduce server with a fairly effective interface and storage format. There may be advantages, disadvantages or bugs related to similar tools such as Couch, but that doesn't mean it can't be the right tool for a given job. I wouldn't equate MongoDB and Node.js though, even if it's easy enough to use them together. One is a server/application platform, the other is a hybrid document database platform.

    4. Re:Wait until you fix your first Node.js disaster. by Anonymous Coward · · Score: 0

      Yo JavaScript, I'mma let you finish. Brainfuck (Turing tarpit) is the one of the biggest computing disasters of all time.

    5. Re:Wait until you fix your first Node.js disaster. by leptons · · Score: 1

      Then add coffeescript on top and your Rube Goldberg machine is complete.

    6. Re:Wait until you fix your first Node.js disaster. by Anonymous Coward · · Score: 0, Interesting

      Not sure this is even qualified to be "insightful". WTF is node.js got to do with MongoDB or visa versa for fucked up implementation and coding incompetence? Any fucktard can fuck up simple shit like node.js and MongoDB setup, just as easily as any fucktard can fuck up Oracle and C/C++/Java/etc. Do you jerk yourself off with fantasy thinking that migrating to "enterprise ready" stack everywhere will make you a better person?

    7. Re:Wait until you fix your first Node.js disaster. by Anonymous Coward · · Score: 0

      here here!

      there there!

    8. Re:Wait until you fix your first Node.js disaster. by Anonymous Coward · · Score: 0

      where!? where!?

    9. Re:Wait until you fix your first Node.js disaster. by Anonymous Coward · · Score: 0

      Using the closure compiler makes it tolerable for larger-scale projects.

    10. Re:Wait until you fix your first Node.js disaster. by kestasjk · · Score: 1

      I wrote some JavaScript for a web game I wrote, just to take some load off the server: I did it quickly as an emergency measure, but I used the Prototype framework to try and make things easier and quicker.
      Once I was done, writing it only for Firefox 3 and IE8, I found it all worked perfectly on IE6 (the simple CSS would look awful, but this pretty complex JS code ran first time). Since then it has needed little maintenance, has been extended by others, and works fine on all modern smartphone browsers (having been developed on and written with only Firefox and IE8 in mind).

      There aren't many IE6-era standards which can still be used to do decent things: 99% of JavaScript sucks ass, but what's amazing is that the other 1% makes up for it so well. It could have been much worse (see ActiveX, VBscript, Flash, Java applets, for the alternatives championed with much more backing)..

      It's just the old problem of a language being easy to write bad code in and/or a good language on a bad/inconsistent platform. Some JavaScript is a nightmare, and no-one would dispute that, but if you use a decent framework like Prototype, jQuery, or YUI, and don't try and write JavaScript like Java, you can write some very neat, concise, well-structured code.


      As an aside: If you want something to show you why JavaScript doesn't have to be so bad (but not glossing over the awful stuff to avoid) check out Crockford's 6 lectures on JavaScript (much more than a dry guide to syntax).
      He's also involved with the standards process and gives his commentary on the future along the way.

      --
      // MD_Update(&m,buf,j);
    11. Re:Wait until you fix your first Node.js disaster. by dOxxx · · Score: 1

      I don't think you said 'fuck' enough.

  14. Slashdot was better without JavaScript. by Anonymous Coward · · Score: 1

    Slashdot, and most other web sites, were far better without JavaScript. Over successive site "redesigns", Slashdot has become increasingly harder and less-efficient to read, and it's much more of a pain in the ass to post comments now.

    One used to be able to view all comments in a story by merely changing a dropdown and clicking a button. Now, in order to do the same, we have to drag that stupid JavaScript "Score" slider thing at least twice, with it usually fucking up and not dragging properly a few times. Then we have to scroll to the bottom of the page and click the "Get More Comments" button. This usually has to be done at least 5 to 10 times, since most stories have a few hundred comments. It's far, far worse than it was before.

    I know there's a "classic" mode for registered Slashdot users, but I'm not such a user, and never will be. Even then, I hear it's just the previous not-as-shitty-but-still-shitty version that uses JavaScript, just not as stupidly as the current version.

    1. Re:Slashdot was better without JavaScript. by drinkypoo · · Score: 1

      I know there's a "classic" mode for registered Slashdot users, but I'm not such a user, and never will be.

      Since your comment was so entertaining, perhaps you will tell us why you won't subscribe, if it doesn't come down to simple incompetence. For me it's that and slashvertisements.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    2. Re:Slashdot was better without JavaScript. by jc42 · · Score: 2

      Since your comment was so entertaining, perhaps you will tell us why you won't subscribe, if it doesn't come down to simple incompetence.

      It wasn't my comment that you replied to, but I can explain why I don't subscribe to a lot of sites that I read regularly. One of the main reasons is that my file of sites/logins/passwords has grown to over 200 entries, and I'm starting to consider this a major security issue. Someone who gets their hands on this file could become a real PITA in my life. So I'm looking for ways to minimize the possible damage from this incoherent pile of security data.

      The most obvious way is by minimizing its size. I no longer create logins casually; I ask myself whether this new request to make up a login id and password is really all that important to my life. Usually the answer is "No."

      I do have a /. login, which I created back when my pile of logins was much smaller than it is now. If I were to run across /. today for the first time, there's a good chance that I wouldn't create an account here. Yeah, it's fun to comment (or flame or whatever), but it's not actually all that important to my life. I can understand why someone else might take the same attitude, even if they're a regular reader. I'm a regular reader of lots of sites where I don't have an account.

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
  15. Re:Enough pussy-footing ... by fygment · · Score: 5, Funny

    ... how do you really feel?

    --
    "Consensus" in science is _always_ a political construct.
  16. I agree by Anonymous Coward · · Score: 0

    I would be embarrassed if created a language of Javascript quality for widespread use. I just wish Python was the standard browser programming language. Heck, PHP or Perl would be a significant improvement!

    1. Re:I agree by Anonymous Coward · · Score: 0

      I'm not sure if theres been significant changes since then but I remember having to update some existing functionality written entirely using CGI.pm and I swear it made me throw up a little in my mouth.

      Not saying that Perl couldn't be used well, just that past instances of people trying to that I have been forced to maintain were all exercises in excruciating pain.

  17. Re:How is popularity over quality bad? by fygment · · Score: 1

    Maybe the failure was that no one who was tech savvy deemed it worthwhile to create a language that could be popular.

    So here's a challenge: instead of bitching about js come up with something that can draw users away from js.

    If you can't, then who's the failure?

    --
    "Consensus" in science is _always_ a political construct.
  18. jQuery, Dojo, YUI, etc. are not innovations. by Anonymous Coward · · Score: 0

    Those aren't "innovations". They're merely hacks to get around some serious deficiencies with JavaScript and its browser-based runtime environment.

    jQuery, for instance, wouldn't even be useful if the DOM weren't so horribly fucked up, and if JavaScript and DOM implementations didn't vary so much between different browsers.

    1. Re:jQuery, Dojo, YUI, etc. are not innovations. by xero314 · · Score: 1

      They're merely hacks to get around some serious deficiencies with JavaScript...

      Much like libc is just a hack to get around some serious deficiencies of C.

      Query, for instance, wouldn't even be useful if the DOM weren't so horribly fucked up

      And what does that have to do with JavaScript? You are saying the language is bad because one of the libraries is bad. Might as well go around complaining about every language at that point, because they all have some screwed up libraries.

  19. Re:How is popularity over quality bad? by Hognoxious · · Score: 1

    So here's a challenge: instead of bitching about js come up with something that can draw users away from js.

    If you can't, then who's the failure?

    At logic, it's you.

    I don't need to have made any movies to know that Uwe Boll is shit.

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  20. Re:Javascript might be in *it's* most important ti by BenoitRen · · Score: 1

    What you emphasise isn't even written correctly. Please retake your grammar classes.

  21. Thank you for your ignorance. by Anonymous Coward · · Score: 1, Interesting

    In the whole scheme of things, no, the Web isn't overly important. Yes, it's very visible and very hyped in the media, but it's still a comparatively small part of the Internet as a whole. BitTorrent traffic alone far outweighs Web traffic. Then there are more traditional uses like FTP and email. Voice and video teleconferencing are always becoming more prevalent. Then there's also gaming. Don't forget DNS. And there are many other more technical uses that I know you won't be familiar with.

    Sites that use Flash and/or JavaScript heavily tend to be rather useless. Slashdot has gotten progressively worse to use as more JavaScript has been introduced. Likewise, Flash doesn't really add anything useful to the table. We could download and play games long before Flash existed. We could stream videos using RealPlayer and other technologies long before YouTube existed. In fact, those real applications are often much effective to use than the Flash- or JavaScript-based "equivalents". GMail, for example, will never be as usable as real email clients like mutt, Thunderbird, and even Outlook.

    iOS is already on its way out. Android is absolutely crushing it. Every sensible developer is moving to Android, and the language there isn't JavaScript. It's Java.

    JavaScript is nearly irrelevant in the big picture. As a JavaScript advocate, I know you have trouble seeing that. But that's just because of your ignorance. You just aren't aware of the greater scene. Of course JavaScript will look important to you, because it seems that JavaScript is the only thing that you know. Not everyone is as ignorant as you, however. We see that JavaScript is merely a small turd in a huge toilet.

    1. Re:Thank you for your ignorance. by Anonymous Coward · · Score: 0

      Why measure importance based on bits transferred, what about time spent? People might leave their bittorrent downloading in the background, but how much time do they spend actually using and interacting with it compared to web pages? I think human minutes is a better measure of importance than bits transferred.

      Secondly, while you might prefer non-flash methods of downloading video, even if we agreed flash was a worse method, that wouldn't reduce the importance of youtube and web-embedded video in general, based on how much video people view/share with it. A large and ever increasing amount of news, tv shows, and personal videos are distributed this way.

      Android might be overtaking ios, but ios is still massive, and javascript works on both, as well as many different desktop operatings system, and web-pages with javascript require no real installation. This is one of the main reasons it's so popular and will continue to be.

      So what you mean when you say it's "irrelevant" is hard to determine, except perhaps it's irrelevant to those kinds of application you consider good or valid. If we simply consider the number and popularity of programs, then web-pages with javascript are clearly towards the top of the relevance scale.

      It may be true that for every line of javascript there's a thousand lines of c supporting it, but for every c program that supports the basic structure of the web, there's a thousand web-pages with javascript that run on top of it.

    2. Re:Thank you for your ignorance. by jc42 · · Score: 2

      Why measure importance based on bits transferred, what about time spent? ... I think human minutes is a better measure of importance than bits transferred.

      Well, maybe, but we should be careful with such comparisons. It strikes me as similar to the common practice among management of measuring programmer productivity by counting the number of lines of code produced. It's hard to imagine any worse measure that lines of code, but "time spent" could be a good challenger. Do we really want to encourage management to measure our productivity by time spent?

      After using JS on any number of projects, I'd have to say that the time I spent versus the useful results has generally been among the lowest of any of the several dozen programming languages that I'm fluent in. This isn't the fault of the language itself, of course; it's the fault of the turkeys that introduced all the niggling little incompatibilities in the JS in the most-used browsers. And the computer biz has a way of encouraging vendors to do just this. For "local" languages (like C), this may be just a minor annoyance, but the primary reason for JS's existence is to provide a way of downloading code that runs in the client's browser. If you need different code for different browsers, your language has failed at its primary task. The java people understood this, but the folks who brought us JS clearly didn't. Either that, or they introduced all those incompatibilities with malice aforethought, intentionally wasting my time trying to write JS that runs the same everywhere.

      A good replacement for JS would be a language designed explicitly to minimize the time spent by all the web developers who currently are being bogged down by the difficulty of making even the simplest JS script work the same everywhere.

      My general approach is to delay the use of JS as long as possible. In my experience, once you introduce JS to a project, the time to get anything running correctly goes up by orders of magnitude. So if you can find an acceptable way of providing the content without using JS, it's a big win for everyone.

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
    3. Re:Thank you for your ignorance. by outsider007 · · Score: 1

      I think we can use the traditional measurement of importance - money. As soon as a bittorrent site IPOs into the billions we can talk.

      --
      If you mod me down the terrorists will have won
    4. Re:Thank you for your ignorance. by Anonymous Coward · · Score: 0

      To clarify, I was talking about time spent by people using the programs (web-browser or bittorrent). Not time spent writing the code. I had thought this was made clear by the sentence you replaced with "...", specifically:

      "People might leave their bittorrent downloading in the background, but how much time do they spend actually using and interacting with it compared to web pages?"

      The issue was whether the web is an important part of the internet. Bittorrent might transfer more bits, but I would hazard a guess that the web gets a lot more use when measured by human-minutes, as opposed to network bits. Surely this is one (though not the only) valid measure of importance.

    5. Re:Thank you for your ignorance. by somersault · · Score: 1

      Your issue there isn't with JavaScript. It's with the lack of a standardised DOM.

      Anyway, all the arguing about how good JS is is irrelevant. You're right. As programming experiences are, I find it's pretty shit developing web apps compared to desktop apps. But the real discussion here should be about its claimed importance, not its merits.

      --
      which is totally what she said
    6. Re:Thank you for your ignorance. by Anonymous Coward · · Score: 0

      Actually, DOM standard is right there @ w3c.

    7. Re:Thank you for your ignorance. by somersault · · Score: 1

      Okay, lack of certain browsers implementing the DOM standard correctly then.

      --
      which is totally what she said
    8. Re:Thank you for your ignorance. by leptons · · Score: 1

      yet another programmer that doesn't understand the difference between DOM and JavaScript. you can run javascript outside of a web browser using many different engines, and guess what? the incompatabilities are a non-issue, because there is no DOM implementation to work around. Programmers who arent that familiar with javascript often blame javascript for being such a pain to work with, when it really is differing DOM implementations that are causing their frustration.

  22. Crockford on JavaScript by aixylinux · · Score: 2

    I don't see where anyone has yet mentioned Doug Crockford's excellent videos on JavaScript. These are all on YUI theater. http://developer.yahoo.com/yui/theater/ All the criticisms mentioned here are discussed in depth. Crockford deals with the good and bad parts of JavaScript from the perspective of years of detailed research on it. And like it or no, JS is available in a useful, common subset on all modern browsers. The whole HTML, CSS, DOM, JavaScript ball of wax is a kludge that happened by the chaos of historic accident. But we are stuck with them, and Crockford's notions of how to do JS right are worth your time in viewing the videos.

    1. Re:Crockford on JavaScript by baxrob · · Score: 1

      [mod parent up] Thanks for the link. I would also recommend Douglas Crockford's thorough, concise, "JavaScript: The Good Parts". (Yes, there /are/ good aspects to JS. As for the rest, Crockford does due justice, including "Appendix A: Awful Parts", and "Appendix B: Bad Parts".)

  23. Web browser/server by Roger+W+Moore · · Score: 1

    C isn't web scale.

    Really? Then what language was your Web Browser or the Web server you connect to written with? It's most likely C/C++.

    1. Re:Web browser/server by x*yy*x · · Score: 1

      Apache Tomcat is written with Java.

    2. Re:Web browser/server by Teckla · · Score: 2

      Apache Tomcat is written with Java.

      And it runs on a JVM written in C/C++.

  24. Re:Javascript might be in *it's* most important ti by Anonymous Coward · · Score: 0

    I had to read that title multiple times... Then gave up and read the post, which only confused me further. In case anyone else is as confused as I was, I finally decoded it: Javascript might be in *its* most important time ...but in no way is it the most important programming language of all.

  25. Every other language is a disaster by Anonymous Coward · · Score: 0

    Javascript has first class functions and closures.

    function add(x){
            return (function(y){ return x+y;});
    }
    f = add(10);
    f(32); // is 42;

  26. it's called "object oriented programming" by t2t10 · · Score: 1

    That's the way it works in object oriented programming: objects have states and objects can have multiple names.

    If you don't like that, program in a functional programming language, or just stop using "=".

  27. Design by commitee vs. design by guru by Animats · · Score: 4, Interesting

    The C++ standards committee has been lost in template la-la land for the last decade. They've focused on features understood by few and used correctly in production code by fewer. Since the discovery that the C++ template system could be abused as a term-rewriting system to perform arbitrary computations at run-time, that concept has received far too much attention. It's an ugly way to program, but it's "l33t". On the other hand, they've been unable to fix any of the fundamental safety problems in the language. C++ is unique among mainstream languages in providing hiding ("abstraction") without memory safety. (C has neither, Simula, Pascal, Ada, Java, Delphi, Erlang, Haskell, Go, and all the "scripting languages" have both.) So there's an example of a committee screwing up.

    On the Python side, we have von Rossum. The problem there is that he likes features that are easy to implement in his CPython implementation, which is a naive interpreter, even if they inhibit most attempts at optimization. As a result, Python isn't much faster than it was a decade ago, and is still about 60x slower than C. Attempts to speed it up have either failed or resulted in insanely complex, yet still sluggish, implementations. So that's the "guru" approach.

    1. Re:Design by commitee vs. design by guru by shutdown+-p+now · · Score: 1

      On the other hand, they've been unable to fix any of the fundamental safety problems in the language. C++ is unique among mainstream languages in providing hiding ("abstraction") without memory safety.

      That is precisely what makes C++ irreplaceable - it lets you go as high-level as you want, but the core language doesn't bother with safety, which makes it fast. If you need safety, you add it in your abstractions (smart pointers, containers etc). With user-defined literals in C++0x, the final missing piece of the puzzle is there - you can also make string literals fully safe (i.e. objects rather than raw pointers) if you want.

      Since the discovery that the C++ template system could be abused as a term-rewriting system to perform arbitrary computations at run-time, that concept has received far too much attention

      Did you mean to write "at compile-time"?

      The reason why this gets much attention is, again, the focus on speed. C++ templates let you write DSLs (which are popular these days everywhere, not just in C++ - just look at RoR), which have zero runtime overhead because all processing is done at compile-time.

    2. Re:Design by commitee vs. design by guru by Animats · · Score: 1

      Did you mean to write "at compile-time"?

      Yes.

      core language doesn't bother with safety, which makes it fast.

      That's a popular misconception of C and C++ programmers. There are modern hard-compiled languages with memory safety. Modula 3 (which, sadly, died with DEC), Erlang (popular in telephony, where speed really matters), and even Delphi (which sank with Borland) had decent solutions to the safety problem without speed penalties. Go is the coming safe language that goes fast.

      (If you're not familiar with the technical issues, the basic problem with C is that you have to lie to the language about arrays. The "pointer = array" concept means that you tell the compiler you're passing an object by reference when you're in fact passing an array by reference. You can't even express in the language that you're passing an array. So the compiler can't tell what you're doing and check it. This is the underlying language flaw which allows buffer overflows. Microsoft kludged up something called "Standard Annotation Language" to deal with this lack of expressive power, developed some tools that use it, and they find it useful. But as a language bolt-on, it's limited.)

      Pushing the safety problem up to a macro level (where templates live) just pastes wallpaper over the mold at the bottom. The mold always seeps through, because too many things still require raw pointers. Every day, millions of program crashes occur because of this.

    3. Re:Design by commitee vs. design by guru by shutdown+-p+now · · Score: 1

      Modula 3 (which, sadly, died with DEC), Erlang (popular in telephony, where speed really matters), and even Delphi (which sank with Borland) had decent solutions to the safety problem without speed penalties

      I can't comment on Modula-3 and Erlang, but Delphi was most certainly not any more memory safe than C - it also allowed unsafe pointer casts, and, more importantly, it had explicit object deletion (and, consequently, the whole problem of dangling pointers).

      (If you're not familiar with the technical issues, the basic problem with C is that you have to lie to the language about arrays. The "pointer = array" concept means that you tell the compiler you're passing an object by reference when you're in fact passing an array by reference. You can't even express in the language that you're passing an array. So the compiler can't tell what you're doing and check it.

      Neither in C nor in C++, array is not the same as pointer. The inconvenience is that array decays to pointer in most contexts.

      That said, in C++ (which is what we were talking about), it is, in fact, very easy to pass an array by reference without losing its size:

      template<size_t a_length>
      void foo(int (&a)[a_length]) {
        for (size_t i = 0; i < a_length; ++i) ++a[i];
      }
       
      int a[3], b[4];
      foo(a);
      foo(b);

      Of course, in idiomatic C++, you'd simply use std::vector or another container, where its size is part of the object and can be queried.

      But what does this have to do with memory safety in general? Memory safety is a problem that's far broader than passing complete array metadata to functions...

    4. Re:Design by commitee vs. design by guru by benthurston27 · · Score: 1

      Well, Python is much faster than it was a decade ago because computers have doubled in speed 6 times since then. That's more than the 60 fold that Python is slower than C by. I think all the nice features of Python make it so you can write a complex program much faster and easier but you take an admittedly pretty severe performance penalty as it is right now, but imagine if as much time had gone into JIT Python as has gone into JIT javascript where it would be.

    5. Re:Design by commitee vs. design by guru by Animats · · Score: 1

      That said, in C++ (which is what we were talking about), it is, in fact, very easy to pass an array by reference without losing its size.

      That trick only works in a few contexts, ones where the array size is known at compile time, has not yet been lost by the language and "sizeof" will still work. If you pass the array through to another function, the size is lost. Even

      int n = 10;
      int d[n]; // works, C99 extension
      foo(d); // fails, template won't match.

      won't work.

      I once proposed generalizing the C99 feature of allowing dynamically sized arrays at the language level to allowing a similar syntax in all array-related contexts. Then you'd have UNIX read declared as

      int read(int fd, char(&buf)[n], size_t n);

      instead of passing "buf" as "char *", which is a lie to the language. The function now knows the size of the array, which would be accessible via "sizeof()" and "lengthof()" and usable for subscript checking. But there are no array descriptors or template code bloat. You've simply told the compiler what you're really doing, instead of lying to it by passing an array as "char *" It turns out that you can almost, but not quite, retrofit this compatibly. So it's too much of a change for C or C++ at this late date.

      Incidentally, subscript checking is cheap if the compiler knows what's going on and can hoist subscript checks out of loops. For most FOR loops, subscript checks can be done once at loop start or even optimized out entirely. If subscript checks are implemented in templates, though, the compiler has to execute them every time. That's why a macro-based approach is inferior.

    6. Re:Design by commitee vs. design by guru by shutdown+-p+now · · Score: 1

      That trick only works in a few contexts, ones where the array size is known at compile time, has not yet been lost by the language and "sizeof" will still work.

      C/C++ arrays are inherently compile-time, with size being part of the type (which is a compile time construct). That's why there's std::vector in C++.

      If you pass the array through to another function, the size is lost.

      If you use the trick as quoted, you can pass the array through several functions easily. The real problem is that you can't store it (in a global or a field), since type of the variable would have to be in scope of template as well.

      I've no idea what the compiler is supposed to do for your C99 snippet, as C99 is not part of C++ standard. If the compiler implements such a weird mix (I don't think anyone does; would g++ permit VLAs in .cpp files?), it's entirely implementation-defined.

      I once proposed generalizing the C99 feature of allowing dynamically sized arrays at the language level to allowing a similar syntax in all array-related contexts.

      This has the same fundamental problems as C99 VLA themselves - it introduces a runtime component to the type system, which is inherently compile-time. In C99, the breakage is most immediately seen by the fact that type system does not actually verify that you pass correct size in. For example:

      void foo(int n, int a[n]);
      int a[3];
      foo(3, a); // correct,
      foo(10, a); // incorrect, but compiler won't catch it

      More generally, C99 VLAs, on type system level, are some kind of a weird type where length is "not directly known, but there is an associated value" - so you get types with attached (runtime) values etc.

      Anyway, in C++ today you just use std::vector and don't care about all this. The only downside there is that it's always heap-allocated, whereas C99 VLAs can be stack-allocated. In theory a smart compiler could actually figure out where this is permissible, but it's very tricky - it has to consider operations which require heap allocation (resize, move, swap), use of allocators, specializations of std::allocator, and overloaded operator new/delete. No-one actually does that in practice.

      Now, it would actually help a lot if we had a separate type which only has those operations available on it which permit stack-allocated implementation. Compilers could then provide a straightforward "pixie dust" implementation for that type when used for an auto local, just as efficient as C99 VLAs (but with size being part of the array, and the whole arrangement thus being actually memory-safe, with no possibility to pass an incorrect size), as a matter of quality of implementation. A standard proposal for this exists, calling such a type std::dynarray. So far as I know, it is being considered as part of C++ TR2. If it passes, it would, in my opinion, be the best solution to the problem.

      If subscript checks are implemented in templates, though, the compiler has to execute them every time

      I'm not sure what you mean by this. A function template, once instantiated, is a function like any other, and any template parameters become simple constants in the instantiation. If you call such a function in a loop, then it's up to the compiler to inline it (and then hoist the check) or not, but this is the same for both template and non-template functions.

    7. Re:Design by commitee vs. design by guru by Animats · · Score: 1

      If you use the trick as quoted, you can pass the array through several functions easily. The real problem is that you can't store it (in a global or a field), since type of the variable would have to be in scope of template as well.

      Right. And that's the problem. It's only useful when size is determined entirely at compile time.

      I've no idea what the compiler is supposed to do for your C99 snippet, as C99 is not part of C++ standard.

      GCC implements that. I'm not sure whether the C++ committee adopted that from C99 somewhere along the way, or whether that's a GCC extension. It's a big performance win in numerical work. Look at "Numerical Recipes in C", where the classic editions have many allocation calls at the entrance to functions that need scratch arrays.

      I once proposed generalizing the C99 feature of allowing dynamically sized arrays at the language level to allowing a similar syntax in all array-related contexts.

      This has the same fundamental problems as C99 VLA themselves - it introduces a runtime component to the type system, which is inherently compile-time.

      That's what I proposed to extend. The basic concept is that the compiler knows what expression defines the length, but does not store it separately from the programmer-defined expression which defines it. In most useful programs, there is some expression that describes the size of each dynamically allocated array. The problem in C is that the programmer (and maintainers of the code) have to know what that expression is, but can't write it in the language. Microsoft Standard Attribute Notation does have syntax for that, but that's a Microsoft extension.

      In C99, the breakage is most immediately seen by the fact that type system does not actually verify that you pass correct size in. ... More generally, C99 VLAs, on type system level, are some kind of a weird type where length is "not directly known, but there is an associated value" - so you get types with attached (runtime) values etc.

      Exactly. That's the right idea. It's just not general enough yet.

      Anyway, in C++ today you just use std::vector and don't care about all this. The only downside there is that it's always heap-allocated, whereas C99 VLAs can be stack-allocated.

      Which is why allocation dominates the cost of computation for some common number-crunching functions used on smaller arrays. (I used to do dynamics simulation engines, and had to worry about this.) Also,with std::vector, you take an additional indirection on each reference, although some compilers can optimized that out.

      A standard proposal for this exists, calling such a type std::dynarray. So far as I know, it is being considered as part of C++ TR2. If it passes, it would, in my opinion, be the best solution to the problem.

      I originally proposed that about a decade ago, but it didn't use enough template features for the Boost crowd. It's good to see that it's finally happening.

      If subscript checks are implemented in templates, though, the compiler has to execute them every time.

      I'm not sure what you mean by this. A function template, once instantiated, is a function like any other, and any template parameters become simple constants in the instantiation. If you call such a function in a loop, then it's up to the compiler to inline it (and then hoist the check) or not, but this is the same for both template and non-template functions.

      The question is whether the compiler is allowed to generate code that detects an error early, before all computation up to the error point has executed. If errors are reported as exceptions when they occur, they're part of normal control flow, and the exception can't be thrown until the error occurs. If the compiler understands that this is an e

    8. Re:Design by commitee vs. design by guru by shutdown+-p+now · · Score: 1

      The question is whether the compiler is allowed to generate code that detects an error early, before all computation up to the error point has executed. If errors are reported as exceptions when they occur, they're part of normal control flow, and the exception can't be thrown until the error occurs. . If the compiler understands that this is an error check, subscript checks can often be hoisted out of loops up to the loop entrance. If there's going to be a memory access error, the compiler can take error action as soon as the error (as "undefined behavior") becomes inevitable, before entering the loop.

      I'm still not clear on how templates change any of this. If your template doesn't throw on error, but just goes on to access the element, then it is U.B. all the same (just like all STL containers, except for at() which is specifically there if you want [] that throws). And then everything that you wrote applies equally.

    9. Re:Design by commitee vs. design by guru by Anonymous Coward · · Score: 0

      > Since the discovery that the C++ template system could be abused as a term-rewriting system to perform arbitrary computations at run-time, that concept has received far too much attention.

      You meant compile-time.

  28. Obviously... by Anonymous Coward · · Score: 1

    ... you've never heard of ColdFusion ("JavaScript" server-side) or worked with prototype/jquery

    JavaScript is a quirky, but powerful language. Sorry, man. You're missing the boat.

    1. Re:Obviously... by rubycodez · · Score: 1

      sure we've heard of that diseased crap, and avoid it like the plague. enjoy your Titanic, "nice boat".

  29. flex vs. html5 by Anonymous Coward · · Score: 0

    which is better? from what i read html5 seems to be too simple. i have played with flash builder 4 and really like flex a lot. i am coming from an oo php background.

  30. And they say Apple has a reality distortion field by itsdapead · · Score: 4, Insightful

    BitTorrent traffic alone far outweighs Web traffic.

    ...and many people locate the BitTorrent they want to use by searching on the web.

    Then there are more traditional uses like FTP

    ...and many people locate the file they want to download by FTP by following a link on a web site (assuming they don't download it using HTTP).

    and email.

    Which many people now access via a webmail application such as Gmail or Outlook Web Access - and while they aren't going to supplant email anytime soon, people are increasingly using social networking sites like Facebook and Twitter to communicate.

    Voice and video teleconferencing are always becoming more prevalent. Then there's also gaming.

    ...and people don't use the web at all to locate people, find game servers, find out about games or even play them on line?

    Don't forget DNS. And there are many other more technical uses that I know you won't be familiar with.

    Actually, I've been using the Internet since before the web existed, and I've even written POP and SMTP clients in lovingly hand-crafted C so cut the patronising crap - I do actually know the difference between the web and the Internet. The argument was whether the Web was an important part of the Internet - not whether it was the only use.

    Sites that use Flash and/or JavaScript heavily tend to be rather useless. Slashdot has gotten progressively worse to use as more JavaScript has been introduced.

    OTOH, sites like Google Maps and Docs use it to great effect. I'd agree that Slashdot is a less than stellar example (and I'm not quite sure why it needs so much scripting to do what it does).

    Likewise, Flash doesn't really add anything useful to the table.

    Vector graphics and object-based animation that scale nicely without having to be coded from scratch? Its particularly suitable for things like online tests and educational applets. Again, it can be abused by using it for things that could/should be done in plain old HTML - and its use it for animated/interactive ads may be annoying, but that doesn't make it insignificant. Plus, all the people flaming iOS because it doesn't support Flash presumably think its good for something. For my money, it ought to be replaced by HTML5+SVG+DOM+CSS+AJAX+Javascript in the long term, but the development tools aren't there yet.

    We could download and play games long before Flash existed.

    In a format that would run unmodified on Windows, Mac, Linux on some mobile devices? Well, yes, there is Java - although I've found Flash to be more consistent cross-platform and easier to deliver (the plug-in is a simple download which most people already have, and its trivial to package Flash as stand alone .exe or .app files that run without plugins) and Flash's graphics engine is perfect for simple 2d games. Java may be better for complex stuff Minecraft, but if I wanted to write a poker app I'd choose Flash (until/unless SVG is properly supported across browsers). Plus, Flash is biggest in "on line" games like Farmville, which are tied to web-based social networking.

    We could stream videos using RealPlayer and other technologies long before YouTube existed. In fact, those real applications are often much effective to use than the Flash- or JavaScript-based "equivalents".

    Sometimes the issue is not just technical. Macromedia/Adobe give away the player plug-in, make their money selling tools to content creators and only bug users when an update to the player is available. RealPlayer were continually trying to push their premium media player software and content on your users. You could tell users to go install Flash player without them coming back and asking if they had to pay (because Real had made the "Free Playe

    --
    In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
  31. What happened? by s4ft · · Score: 1

    Strange thing I tried to read the article and while loading the page I got: Javascript Error Code: 857 Cannot render pages flaming the language it self.

  32. You misnamed newObj by Anonymous Coward · · Score: 0

    You should have called it refObj. I don't program JS; so take this FWIW but I have to agree with the other posters. I think the "magic" you're looking for is:

    var newObj = new Object();

    I'm sure some JS guy can show us how to write a copy constructor for Object. Not knowing much about the language I'd say the worst case is that it'd be a function full of getter and setter calls.

  33. The most important of all ... by tenco · · Score: 1
    ... to block.

    Why would I want to act as a computing node for every jerk who owns(!) a website and chooses to offload computing tasks via JS onto my box?

  34. PHP? by Anonymous Coward · · Score: 0

    In what way is PHP an improvement of JavaScript? That is one ugly kluge of a language.

  35. There's always a fallback by syockit · · Score: 1
    Just in case Javascript fails so much that no consensus can be made on how it should be implemented and how further development should be directed:

    "We still have VBScript"

    --
    Democracy is for the people; you only vote once per season and we'll do the rest of the work for you don't have to.
  36. No MongoDB is web scale by Billly+Gates · · Score: 1

    A whole summary of why NoSQL MongoDB is the absolutely best right here compared to RDBMS. Go MongoDB!

  37. I love assembler, C and javascript by Anonymous Coward · · Score: 0

    I'm expert in C and assembler programming since more than 20 years.

    Javascript is just perfect to write multi-platform and remotely accessible AJAX user interfaces for C/PHP/mySQL applications, despite the lack of true multithreading (although multithreading can be emulated: http://ltiwww.epfl.ch/sJavascript/), and actual differences in CSS implementations and other MS non-interoperability policy bullshit.

    With the new chrome JS engine, execution speed is now acceptable.

    And with jQuery it's a pleasure to write efficient and reusable cross-browser compatible modules.

    C and assembler have nothing to do with "stone age", they are the bottom layers on which are based higher level languages.
    Because C follows the assembler concepts, with observation and experience one can easily imagine the assembler code the C code will be compiled into, and write very efficient object code in terms of memory usage and performance.

  38. Good Functionality from Bad Languages by oldCoder · · Score: 1

    There were actual reasons that COBOL was more used than, say, ALGOL, although they both became available at the same time, and ALGOL was the better language.

    JavaScript is a medium-quality language, with less utility but roughly the same number of flaws as C. What makes it so terrible are the broken tools, broken and old browsers, amateur coders, dumb DOM, and so on.

    And what makes all of this worse is the inescapable monopoly it has over client-side web coding.

    --

    I18N == Intergalacticization
  39. Your obviously not using it right. by Anonymous Coward · · Score: 0

    While i can not say i have a ton of experience using java script, i can say it's good at what it does. It's when you try to make it do something it's not intended to do that you end up with problems. C and C++ are languages that are very good at what they were designed to do. They crate functional programs, that can be easily recompiled to just about any platform. However as i recall JavaScript was designed to make a web-page more interactive not solve the worlds hunger crisis. A tool should be used for it's intended purpose, when you try to use a wrench as a screwdriver you will encounter problems. If your trying to use JavaScript server side then you are just plain using it wrong. It is not the languages fault for your misuse of it. And just because they expanded it so that it can do something does not mean that it should do it. So don't complain about JavaScript not making a good server side language. If you really feel the language is so poor, then go out and design a better one. You can complain after you have completed that. If you still feel you want to complain about a language try WhiteSpace.
    As to JavaScript being one of the most important languages of our time, that is utter BS, at best it is an individuals opinion. All of your languages would break down to nothing with out basic machine code. Yes that language no one here even wants to talk about, and mostly resides inside engineering offices next to huge logic diagrams. Granted it's not portable, or even consistent in many cases. But without it all computers would be nothing more than expensive paperweights. On top of that the importance of a language is irrelevant to anything but financial disbursement. Using it in this context is simply a marketing ploy, and distracts the topc from it's real objective.

  40. Kill Javascript by woofbow · · Score: 1

    Javascript the most important language? Give me a break. It has all but RUINED the web. In the late-90s and early 2000s, lots of good, talented and forward thinking folks were trying their darndest to get behind the web standards movement and encourage everyone to create semantic web pages that loaded quickly, looked great and were perfectly functional. But Javascript is like the worst aspects of capitalism. Or handguns. It has been used to pollute, snarl, corrupt and cripple the web. It is used to steal information, to compromise people's privacy. It is slow and buggy. It requires a lot of CPU overhead. It's not efficient. And it's just plain messy. The antithesis of elegance. Anything with the word "java" in it I have come to hate with a passion. The guy who "invented" it should do the world a favor and commit hari-kiri.

  41. Correct Strategy by Baldrson · · Score: 1
    When going to a new version of a language, the correct strategy is to come up with the highest level language one can conceivably jit-compile and rewrite the current language as syntactic sugars of the higher level language. "Pragmas" may be part of the sugaring (especially since there may be important pragmatic information provided by the lower level language) but it is better if the so-called "pragmas" are, instead, assertions written in the higher level language itself. The answer here is not a functional language but a relational one since functions are degenerate relations. Moreover, since one seeks to have assertions in the place of pragmas, the formal basis of the relational language should be sentence oriented. The sentence-oriented relational formalism most widely accepted across disciplines (including program specification) and with the most history is the predicate calculus. The brain-dead zombies will now start chanting things about Prolog even though it was never an implementation of the predicate calculus and tried to do things that probably should never have been attempted on a DEC-10 anyway. There are neo-zombies who will start chanting things about Erlang. Erlang is a bastardization of Prolog which is a bastardization of the predicate calculus. The best thing I can say about Erlang is that Mozart/Oz is much worse, being is a bastardization of Erlang that is attempting to add relational constructs in without undoing the damage that Erlang did to Prolog -- when, in fact, they should have undone the whole mess, including Prolog, and gotten on with arranging a legitimate marriage of the predicate calculus with computers. If you are such a zombie, spare yourself the pain of reading further.

    So, here is the high level idea (despite the danger of inviting Prolog zombies I'll be using its syntax for the Horn Clause):

    Parallelism spawns independent computations.

    The Horn Clause:

    m(A,B,C):-x(A),y(B),z(C).

    expresses AND parallelism spawning 3 independent computations.

    The Horn Clause document:

    m(A):-x(A). m(A):-y(A). m(A):-z(A).

    expresses OR parallelism spawning 3 independent computations.

    In an operating system, parallel computations are scheduled for execution, allocating resources according to priorities.

    There are also computations which cannot be scheduled until the computations upon which they depend complete. The Horn Clause document:

    m(A,B,C):-m(A),m(B),m(C). m(A):-x(A). m(A):-y(A). m(A):-z(A).

    expresses 3 AND parallel computations, each depending on 3 independent OR parallel computations.

    This kind of data-dependency suspension of scheduling is also handled by operating systems.

    By focusing on these constructs:

    1. AND parallelism
    2. OR parallelism
    3. Scheduling
    4. Dependency suspension

    a radical reduction in semantic complexity can be realized.

    Tools

    Seymour Cray once said that much of engineering creativity comes from using old tools in never-before intended ways. The same is true of anything. New understanding of a thing's use is a way to create a new tool. Indeed, even when creating a new thing-in-itself as a tool (the ordinary means of creating a new tool), what comes first is its desired use. It is harmful to think about the fact that your hammer can be used as a paper-weight when you are pounding a nail into a piece of wood with a rock.

    With that in mind, let us properly-use the Horn Clause.

    Branching is properly scheduled parallelism.

    Looping is either AND parallel recursion or it is properly scheduled OR parallelism.

    Class hierarchy is properly scheduled polymorphism.

    Polymorphism is OR parallelism.

    Exception handling properly scheduled OR-parallelism.

    A database row is cached AND parallelism.

    Numbers are duplicate row counts, dimensioned by the conjunction of the dimensions of their columns (some of which may be, themselves be

  42. Legendary pissing contest is legendary by UtterCoward · · Score: 1

    Even by the usually-high Slashdot standards, this is holy war is setting a new standard for pointlessness and posturing.

  43. I am not scared of the future by Anonymous Coward · · Score: 0

    I have seen JavaScript and my mind went numb, tell him he can't scare me no more with his future works.