text: >>."
  Most important of all? (Score:5, Insightful)
  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.
  Re: (Score:3, Funny)
  Wait until you fix your first Node.js disaster. (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.
  Re: (Score:2)
  here here! had similar experiences in my career - completely agree.
  Re:Enough pussy-footing ... (Score:5, Funny)
  ... how do you really feel?
  Re: (Score:2)
  Re:Most important of all? (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.
  Re:Most important of all? (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".
  Re: (Score:2)
  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).
  Re: (Score:2)
  Re: (Score:2)
  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.
  Web browser/server (Score:2)
  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++.
  Re: (Score:3)
  Apache Tomcat is written with Java.
  And it runs on a JVM written in C/C++.
  Re:Most important of all? (Score:5, Insightful).
  Re: (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.
  Re:Most important of all? (Score:4, Funny)
  Haskell will lose it's cool when someone writes a real program in it and not just code examples.
  Re: (Score:2).
  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
  Re: (Score:2)
  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.
  Re:Most important of all? (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...
  Just typical JavaScript ignorance. (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'
  Re:Just typical JavaScript ignorance. (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 !?
  :-) ).
  Re: (Score:2)
  where's the campaign to make Javascript look more like PHP, I ask !?
  :-) ).
  here: [phpjs.org]
  Re: (Score:2)
  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.
  And they say Apple has a reality distortion field (Score:5, 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
  Re: (Score:3)
  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
  Re: (Score:2)
  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.
  Re: (Score:2)
  Okay, lack of certain browsers implementing the DOM standard correctly then.
  Re: (Score:2, 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.
  Re:Most important of all? (Score:4, 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.
  Re: (Score:2)
  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.
  Re: (Score:2)
  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 Facebo
  Re: (Score:2)
  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.
  Re: (Score:3)
  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
  Re: (Score:2)
  Re:Most important of all? (Score:5, Insightful)
  Re: (Score:2)
  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.
  i still hate it (Score:2) d
  Re: (Score:2)
  Re: (Score:2)
  Standardising browser DOMs should be a much higher priority, though adding other scripting options would be nice. oppos
  it's called "object oriented programming" (Score:2)
  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 "=".
  Re: (Score:2)
  Look at that example again. It's not alert(newObj.foo), it's alert(myObj.foo).
  Re:I have a suggestion. (Score:4)
  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...
  Re:I have a suggestion. (Score:4, Informative)
  Re: (Score:3)
  Re: (Score:2)
  Re: (Score:2)
  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.
  Re: (Score:2)
  Re: (Score:2)
  C++ at least. It's one of the biggest things I miss in Java-like languages. That and RAII.
  Re: (Score:2)
  Re: (Score:2)
  Yet another reason to avoid C#. If I want a pointer to an object I will use that.
  Re: (Score:2)
  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();
  oldOb
  Re: (Score:2)
  Because otherwise, it devolves down to one of those stupid "real men spray III's and V's onto Si" pissing contests.
  fix JavaScript, please (Score:3)
  While I generally don't like stuff coming out ouf technical committees, sometimes the alternative is worse... like in the case of JavaScript.
  Javascript is a disaster (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 prog
  Re:Javascript is a disaster (Score:5, 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.
  Re: (Score:2)
  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.
  Re: (Score:3)
  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.- [bclary.com]
  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 clas
  Re: (Score:2)
  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, bu
  Re: (Score:2)
  Wikipedia defines "Object-Oriented Programming" as
  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 par
  Re: (Score:2)
  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...
  Re: (Score:3)
  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
  Re: (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 ) );
  Re:Javascript is a disaster (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.
  Re: (Score:2)
  num = 10 + 2 + "2"; - becomes 14
  No that becomes 122.
  Re: (Score:2)
  ah, yes, the
  /., place that need total precision. Why can't we read the comments first before leaving others? [slashdot.org]
  Re: (Score:2)
  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.
  // could also place the var statement inline with assignment operator // prints 2 to the JS console // prints 'undefined' to the JS console
  Should be:
  var x = 2;
  function test(){
  var y;
  y = x + 3;
  }
  console.log(x);
  console.log(typeof y);
  - 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 function
  Re: (Score:2)
  god, I am tired [slashdot.org] of you people. [slashdot.org]
  Re: (Score:2)
  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 [jslint.com] (and strictly adhering to it) pretty much eliminates that issue. It can be run on the command line as part
  Re: (Score:2)
  You are correct, I missed 'var'.
  It does not change the fact that there is scope, it only means I made a syntax error.
  Re: (Score:2)
  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.
  Re: (Score:2)
  yes, I said I made a syntax error. [slashdot.org]
  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.
  Re: (Score:2)
  Re: (Score:2)
  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. [slashdot.org]
  Re: (Score:2)
  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...
  Re: (Score:3)
  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() {
  Re: (Score:2)
  and I said: 'few languages allow that', didn't I? Also do we have Perl running inside a browser nowadays?
  Re: (Score:2)
  and here is what I told the other guy [slashdot.org], 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.
  Re: (Score:2)
  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?
  Re: (Score:2)
  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
  Re: (Score:2)
  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
  Re: (Score:2)
  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.
  Re: (Score:2)
  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).!!)
  Re: (Score:2)
  ""+" 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
  Re: (Score:3)
  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
  Re: (Score:3)
  ""+" 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
  Readability (Score:3)
  When did it become acceptable to have the content take up only 1/4 of the page width?
  Re: (Score:2)
  The blank areas are probably full of adverts.
  Re: (Score:2)
  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 [wikipedia.org]. Who cares who wins? It's all about who fights, who's dating, and who's the 1,000,000th page view (CLICK HERE [example.org] to claim your prize!).
  Continual tinkering: required? (Score:2)
  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?
  Re: (Score:2)
  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.
  Crockford on JavaScript (Score:2):How is popularity over quality bad? (Score:2)
  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?
  Re: (Score:2)
  At logic, it's you.
  I don't need to have made any movies to know that Uwe Boll is shit.
  Re: (Score:3, 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
  Re: (Score:2)
  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, architec
  Re: (Score:2)
  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.