Forgot your password?
typodupeerror
Mozilla The Internet News

JavaScript Inventor Speaks Out 267

Posted by samzenpus
from the listen-up dept.
Anonymous Coward writes "Brendan, on his mozillazine blog talks about JavaScript 1, 2, and in between in light of DHTML and AJAX. In an informal blog entry he answers frequently asked questions such as fixing Unicode in regular expressions, multi-threading, weak numeric typing, and obfuscating code."
This discussion has been archived. No new comments can be posted.

JavaScript Inventor Speaks Out

Comments Filter:
  • It Would Be Nice... (Score:3, Interesting)

    by creimer (824291) on Wednesday June 15, 2005 @09:34PM (#12829161) Homepage
    If the "write once, run everywhere" feature was implemented. ;)

    On a related note, I had an interview at Adobe a while back and the interviewer mentioned that javascript was the scripting language for a lot of their products. I drew a blank on that one since I had no idea how use javascript for an application (and, subsequently, didn't get the job). When an application uses javascript for the scripting language, does that mean a javascript parser is also implemented into the application? Or can javascript be used in a standalone environment?
    • by fm6 (162816)
      WORE is Java, not Javascript -- though I'm guessing you knew that. There's actually a platform-independent Java software out there. It's just that people have become too cynical about Java hype to care.
      • I think cremier was making a tongue-in-cheek comment about the dubious use of the name 'Java' in 'JavaScript'.
    • by prockcore (543967) on Wednesday June 15, 2005 @10:56PM (#12829545)
      When an application uses javascript for the scripting language, does that mean a javascript parser is also implemented into the application? Or can javascript be used in a standalone environment?

      A javascript parser is included in the application. The opensource ultima online server UOX3 used SpiderMonkey (Mozilla's javascript engine) to handle server-side scripting.

      It's actually not that difficult to link spidermonkey into your application. I did it once for a benchmark program (it would pull a web page, and parse the javascript banners etc and time how long it took to download every piece of data required to render the page).
  • JavaScript (Score:5, Interesting)

    by nepheles (642829) on Wednesday June 15, 2005 @09:45PM (#12829228) Homepage

    It's a pity JavaScript rarely gets the attention it deserves as a legitimate programming language. Most guides to C begin with teaching you how compilers work; most guides to JavaScript teach you how to swap some images.

    This is unfortunate as it's quite powerful: it supports first-class functions and an excellent generic object-system, not to mention the usual suspects such as dynamic memory management.

    Hopefully its apparent resurgence these days (as browser vendors get their compatibility acts together) will change this.

    • Re:JavaScript (Score:2, Insightful)

      The reason so many stayed away from Javascript was the revealing code. Any browser could have you peek at the developer's work. I knew alot of developers that had a problem with that. They would rather write a slow piece of shit java applet compiled. Javascript was always lightning fast.

      • There are apparently some pretty darn good disassemblers for Java bytecode. I don't think Java bytecode is really any more or less obscure than obscurified javascript.
      • Re:JavaScript (Score:4, Interesting)

        by dtfinch (661405) * on Wednesday June 15, 2005 @11:39PM (#12829697) Journal
        I protect my javascript with stuff like this:

        // Copyright 2005 David Finch
        // Don't steal

        It seems to work. There must be a few people out there who still respect copyright.

        I even put a BSD license on one of my scripts, essentially making it public domain, and somebody asked for permission to copy it.

        shameless plug [mytsoftware.com]
        • Re:JavaScript (Score:3, Interesting)

          by dustmite (667870)

          Heh - interesting, I've had similar experiences. I've written a few (very) small OpenSource games - nothing major, nothing well-known. I've distributed them very clearly under either GPL, BSD or even 'public domain' licenses.

          Yet people seem to have always asked my permission before using the source for anything, however tiny and insignificant the use. Some guys also asked my permission once to do a fork.

          In the beginning it seemed quite weird to me, now I'm kinda used to it.

          So yes, people seem to gener

          • It is probably more of a courtesy thing. It is not so much they are "asking" to use your code as politely informing you that they are using your code.
    • Heck, you can even write your own Unix operating system:

      JSUIX [masswerk.at]

    • I largely blame the poor documentation of using Javascript and incompatibilities in implementation for my wish of a better scripting language in web browsers.

      I've often thought of creating a lite version of Python or Prolog that have some built-in DOM access added and all their parts that pose security issues removed. In general I think that it's a shame that we're mostly limited to one or two languages of limited compatibility for client-side web scripting. At least we can write some of that stuff in the
  • by LetterJ (3524) <j@wynia.org> on Wednesday June 15, 2005 @09:45PM (#12829230) Homepage
    The difference between the Javascript language and the browser objects themselves has become more and more clear to me as I've worked heavily with both more complex Javascript like AJAX (where you aren't spending much time directly interacting with browser objects, but rather staying "inside" Javascript), working with JScript.NET for commandline programs, JScript in WSH and HTA as well as Photoshop scripting.

    Many of the things that bother me about "Javascript" turn out to be problems with IE or Mozilla's objects and not the language itself. Don't get me wrong, things like the Javascript date objects still bug me, but I'm growing to like the language itself much more than I used to.

    If you've only ever used Javascript in a browser, you may not realize that much of what you're working with is really the browser's object model. All of the window., document., document.form, etc. interaction form.submit(), etc. are all browser object properties and methods.

    I noticed before posting some questions about scripting outside the browser. In those environments, you just get a different set of objects instead of document.form, you get objects for the filesystem or an active image, just like in any other programming language that uses objects from outside (COM objects, .NET assemblies etc.)
  • by Anonymous Coward on Wednesday June 15, 2005 @09:53PM (#12829266)
    Try this site to see what I mean.
    http://www.masswerk.at/jsuix/ [masswerk.at]
  • I was hoping he would talk about the decision to put JavaScript in the Netscape browser. I seem to remember at the time that the magazine columnists were saying Sun was upset that Netscape chose JavaScript over TCL and the fact that they chose to name it JavaScript since that confused the masses of people who generally weren't even sure what Java was yet. I guess they were in a hurry to innovate scripting into the browser before you know who did or we would have ended up with vbscript as the de facto web la
    • by fm6 (162816) on Wednesday June 15, 2005 @10:17PM (#12829369) Homepage Journal
      I think by the time Javascript came along, Sun had pretty much lost interest in TCL. I heard stories about people trying to license the Sun implementation of Tcl/Tk and getting a runaround. It's probably not a coincidence that Ousterhout left Sun (and took Tcl with him) at about the same time as Eric Schmidt, who brought Ousterhout on board in the first place.
      • This was at the start of the period when Sun believed that all the world was Java. What is not clear is whether this was a cunning plan to persuade everyone to buy much bigger hardware, or just one of those bizarre fits of corporate Group-Think that happens from time to time when someone slips magic mushrooms into the boardroom's supply of coffee beans...
        • Both your theories assume that everybody at Sun has a common agenda. Not the case. When I worked there, the internecine battles were epic. To the outside world it looks like bizarre decision-making. On the inside, it's simply a matter of whoever's left standing getting to impose their particular policy.
  • by stevens (84346) on Wednesday June 15, 2005 @10:00PM (#12829306) Homepage

    As someone who'd only used Javascript in creating DHTML, I'd worked up a good hate against it. But what I'd hated was really the ridiculously incompatible implementations of the DOM in IE/Netscape. I also hated the embedded space itself--shitty delivery method (encoded or called from HTML, no #include, no namespaces).

    Then I started writing extensions for firefox. I'm trying to show my company that (firefox + xul + js) > (ie + activex). I'm mostly successful, since we already have lots of XML over HTTP data services primed for XmlHttpRequest.

    But it turns out that the language doesn't suck so bad. Sure the namespace problem is JS's fault, but the rest is the embedding. Using JS for firefox exntensions allows you to code to one platform; make more OO libraries, etc. I even generate classes from the DTDs I make the XML services from.

    Who would've thunk it's really a decent language in the dynamic, lambda-toting, functional-ish area?

    • Using JS for firefox exntensions allows you to code to one platform

      Oh, yeah?

      /cygdrive/d/home/mozgest/mozgest/content>grep -i platform *.js
      mozgestOverlay.js: if (e && !mgGestureDone && (e.button == 2 || (navigator.platform == "MacPPC"
      mozgestOverlay.js: if (navigator.platform != "Win32" && navigator.platform != "OS/2") {
      mozgestOverlay.js: var isMac = navigator.platform == "MacPPC";

      /cygdrive/d/home/mozgest/mozgest/cont ent>grep -i isMac *.js
      mozgestOverlay.js: var isMac = na

  • JS rocks (Score:4, Insightful)

    by famebait (450028) on Thursday June 16, 2005 @04:50AM (#12830649)
    It never ceases to amaze me how people can do sometimes extensive work with JavaScript and still not spot what an elegant and powerful language it is. Sure, most of that work is about doing meaningless browser-related stuff and wrestling with bad APIs, but come on. I really do expect from an averagely talented real IT person to be able to separate that from the langauge, and be able to recognise the things it can do that their normal language can't. Its almost single-abstraction design that turns out to be able to do just about everything and still look nice and procedural and newbie-friendly totally rocks.
    • This may be true, but what you're saying is that although all the javaScript work that you will ever do will be as painful as hammering nails into your forehead, JavaScript itself is nevertheless really good fun. it's a rather academic distiction.
    • It never ceases to amaze me how people can do sometimes extensive work with JavaScript and still not spot what an elegant and powerful language it is.

      a = new Array();
      a["width"] = 1;
      a["breadth"] = 2;
      a["length"] = 3;
      alert(a.length()); // Aaaaah!

      b = new Array();
      ob1 = new Object(); // just a random object
      ob2 = new Object(); // and another, different one
      b[ob1] = "This is ob1";
      b[ob2] = "This is ob2";
      alert(b[ob1]); // what do you think this says?

      Javascript has a number of nice features; I can forgive it a l

      • well any language can be written to look fugly. You can also do crazy stuff like you did there using object references as assignement in an array but what advantage would you have in doing such a thing?

        I took your first example and wrote it how I would write it. Look at your code now: function Dimension(width, breadth, length){ this.width = width this.breadth = breadth this.length = length } a = new Dimension(1, 2, 3) alert(a.length)

        Just like you have beautiful perl and python you can

        • I took your first example and wrote it how I would write it.

          Actually, you missed the point on that example; I should have been clearer.

          What I was complaining about was that array elements share namespace with array methods. Which means that once you assign array["length"] to something, array.length doesn't return what you think it does! You can't have an element called 'push' and have access to the Array.push() routine at the same time. This is mind-boggling brain-damaged.

          You can also do crazy stuf

      • JS certainly has design flaws. It was designed very quickly, and evolved under some absurd deadlines at Netscape and in ECMA committee, with the sad, stale background of the "browser wars" (MS crushing Netscape; Netscape mutilating itself with bad decisions, only some of which were due to that rarified competitive pressure).

        Here's the design decision you hate: a JS object is a single-namespace collection of properties, each mapping a string to an arbitrary value. I made that decision quickly, but consci

    • Can anyone recommend a good Intro-to-JS book (not an intro to programming book) that doesn't get bogged down in web-related/browser details?
  • Relief at last! (Score:5, Insightful)

    by Qbertino (265505) on Thursday June 16, 2005 @06:26AM (#12830854)
    Finally somebody who isn't a total dickhead speaks up on the Ajax craze.

    "With DHTML and AJAX hot (or hot again; we've been here before, and I don't like either acronym) ..."

    Bingo!
    The man's right on.
  • by mactari (220786) <[moc.liamg] [ta] [krowfur]> on Thursday June 16, 2005 @10:34AM (#12832131) Homepage
    I'm sorry, but this comment simply doesn't hold:

    JS is not going away, so it ought to evolve. As with sharks (and relationships, see Annie Hall), a programming language is either moving forward, or it's dead.

    No, when a programming language doesn't chance, it's called a standard. Look at what we've been able to do keeping html, css, and javascript a stable target for so many years! It's like Space Invaders on the Atari 2600 -- nobody who created that console, its hardware designed specifically for playing Combat and Video Olympics, expected someone to be able to slap six sprites in a row, much less have the player shoot then down one at a time. The 'standard' that was the 2600, however, gave a stable platform for programmers to learn tricks that would give the console life well beyond its creators' expectations.

    We've got something like that with javascript, and we can see what happens when we compare to something like Visual Basic 6. Developers are still upset about Microsoft's decision to drop official support for VB6 in an attempt to force people to upgrade to VB.NET. Know what? Those upset programmers have found that VB6 hasn't rusted and simply continue using it to create their apps. There are more companies than you'd know (here's one [blackbaud.com]) whose major apps are/were written in VB6, the 'prototyping language'. They're not quite ready to cast the baby out with the bath.

    Fix bigs in javascript? Absolutely. The issue is that we've reached a point where nearly every browser anyone uses supports a 'single' flavor of javascript and we're all familiar with how to make our code work with the few quirks that remain crossplatform. There is a standard on nearly every box on the net that coders can assume will be there for them. I wouldn't want to see anyone mess this stable delivery platform up, splitting the user base into something like what we had in the Netscape 4.x/Mozilla/IE 4 & 5 days. Now *that* was an ugly time to code.

    The bottom line is that evolution is an overused metaphor. You've got two choices if you'd like to propagate your genes into the future: immortality or reproduction. Immortality was a little too difficult to accomplish for living, unique individuals. Perhaps there were little organisms that could live forever, but something squashed 'em. They're gone. That's not a problem in the digital world, folk. We can make as many exact copies of an individual as we'd like. Javascript modules are not unique. They don't need to evolve. (I mean, come on, he even mentions sharks, a design that hasn't changed in millions on millions of years!)

    Javascript should shoot to become an immortal standard, not another field of play and debate.
    • Hey, any analogy can become strained.

      My point was that JS ought to respond to feedback in its niches, not stay unchanged for years on end (as it has, apart from bug fixes). I agree it doesn't need six legs or two heads. But "evolve" -- as in "respond to feedback from users" -- means more than "bug fixing". See my roadmap blog for more on this.

      /be

...when fits of creativity run strong, more than one programmer or writer has been known to abandon the desktop for the more spacious floor. - Fred Brooks, Jr.

Working...