A suggestion for a new Web standard (Discussion)

Discussion in 'Javascript' started by Daz, May 8, 2007.

  1. Daz

    Daz Guest

    Hi everyone.

    Forgive me if I sound Naive, but JavaScript is downloaded to the
    browser, and then compiled into byte code. The resulting byte code (to
    my knowledge), is smaller than the original script.

    Should there be a Web standard that allows us to compress code into
    bytecode, and then send the byte code directly to the browser?

    Perhaps there is a flaw, in the sense that bytecode is different from
    browser to browser, but isn't that what standards are all about?

    I'd be interested in hearing the opinions of others on this subject.

    Many thanks.

    Daz.
     
    Daz, May 8, 2007
    #1
    1. Advertising

  2. Daz

    Tim Slattery Guest

    Daz <> wrote:

    >Hi everyone.
    >
    >Forgive me if I sound Naive, but JavaScript is downloaded to the
    >browser, and then compiled into byte code. The resulting byte code (to
    >my knowledge), is smaller than the original script.


    No bytecode, this is Javascript, not Java. The browser reads and
    interprets the script. Exactly how it does that is up to the browser's
    programmer.

    --
    Tim Slattery

    http://members.cox.net/slatteryt
     
    Tim Slattery, May 8, 2007
    #2
    1. Advertising

  3. On May 8, 11:44 am, Tim Slattery <> wrote:
    > Daz <> wrote:
    > >Hi everyone.

    >
    > >Forgive me if I sound Naive, but JavaScript is downloaded to the
    > >browser, and then compiled into byte code. The resulting byte code (to
    > >my knowledge), is smaller than the original script.

    >
    > No bytecode, this is Javascript, not Java. The browser reads and
    > interprets the script. Exactly how it does that is up to the browser's
    > programmer.
    >
    > --
    > Tim Slattery
    > ://members.cox.net/slatteryt


    I think if we wanna make something like that then maybe we prefer
    using applets instead of javascript. And the good thing about
    Javascript, in my opinion, is mostly the 'script' part. If I wanna
    make something fast, then just gotta script here and there and it's
    done.

    Certainly it's not a bad idea but I think it would be better to
    promote standarization of Javascript among browsers, like W3C does,
    don't you think?
     
    Vicente Raúl Plata Fonseca [XnT], May 8, 2007
    #3
  4. Daz

    RobG Guest

    On May 9, 8:59 am, Randy Webb <> wrote:
    [...]
    > If all browsers were exactly the same, following every standard, then
    > there would end up being only one browser and then you would never have
    > change as the one browser would have no reason to change/update anything.


    I don't think anyone begrudges browser developers offering extensions
    to standards, but life would be very much simpler if they'd all
    support applicable W3C and ECMA standards as a baseline rather than
    providing proprietary standards in lieu.


    --
    Rob
     
    RobG, May 9, 2007
    #4
  5. Daz

    Daz Guest

    On May 8, 11:59 pm, Randy Webb <> wrote:
    > Vicente Raúl Plata Fonseca [XnT] said the following on 5/8/2007 6:50 PM:
    >
    >
    >
    > > On May 8, 11:44 am, Tim Slattery <> wrote:
    > >> Daz <> wrote:
    > >>> Hi everyone.
    > >>> Forgive me if I sound Naive, but JavaScript is downloaded to the
    > >>> browser, and then compiled into byte code. The resulting byte code (to
    > >>> my knowledge), is smaller than the original script.
    > >> No bytecode, this is Javascript, not Java. The browser reads and
    > >> interprets the script. Exactly how it does that is up to the browser's
    > >> programmer.

    > > I think if we wanna make something like that then maybe we prefer
    > > using applets instead of javascript. And the good thing about
    > > Javascript, in my opinion, is mostly the 'script' part. If I wanna
    > > make something fast, then just gotta script here and there and it's
    > > done.

    >
    > > Certainly it's not a bad idea but I think it would be better to
    > > promote standarization of Javascript among browsers, like W3C does,
    > > don't you think?

    >
    > If all browsers were exactly the same, following every standard, then
    > there would end up being only one browser and then you would never have
    > change as the one browser would have no reason to change/update anything.
    >
    > --
    > Randy
    > Chance Favors The Prepared Mind
    > comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
    > Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/


    Incorrect. I'd still choose Firefox over IE any day. Following the
    standards doesn't necessarily mean that that's ALL you can do. For
    example, an inline spell checker, or bookmark manager has nothing to
    do with any standards. Also, it's how you implement the standard that
    matters. If you browser keep crashing all the time, but still supports
    the standards, no-one will use it. :)
     
    Daz, May 9, 2007
    #5
  6. Daz

    Daz Guest

    On May 9, 3:49 am, RobG <> wrote:
    > On May 9, 8:59 am, Randy Webb <> wrote:
    > [...]
    >
    > > If all browsers were exactly the same, following every standard, then
    > > there would end up being only one browser and then you would never have
    > > change as the one browser would have no reason to change/update anything.

    >
    > I don't think anyone begrudges browser developers offering extensions
    > to standards, but life would be very much simpler if they'd all
    > support applicable W3C and ECMA standards as a baseline rather than
    > providing proprietary standards in lieu.
    >
    > --
    > Rob


    Agreed. I was simply thinking from a speed point of view, in order to
    save bandwidth and make things load quicker. I would also love to see
    constants/variable as standard in CSS. That way, we can re-use lines
    of code easily and not have to repeat them anywhere.

    Thanks for your input everyone. I really appreciate it. I suspected
    that the concept was flawed, but figured there was only one way to
    find out. As always it's freedom Vs standards, in the sense that
    browser developers sometimes "use their freedom not to follow
    standards".
     
    Daz, May 9, 2007
    #6
  7. Daz

    Yanick Guest

    On 8 mai, 11:06, Daz <> wrote:
    > Hi everyone.
    >
    > Forgive me if I sound Naive, but JavaScript is downloaded to the
    > browser, and then compiled into byte code. The resulting byte code (to
    > my knowledge), is smaller than the original script.
    >


    Well, not necessarily. If you're looking for a Javascript compiler,
    Rhino has one (http://www.mozilla.org/rhino/jsc.html), but has it was
    said in this thread, browsers implements their own interpretation of
    the language (http://en.wikipedia.org/wiki/JavaScript)

    Unlike Perl or PHP, Javascript files aren't kept in a cache since it
    wasn't originally made to support large, extensive, data
    manipulations ; it's a scripting language to enforce server scripting,
    a mean to control the portion of HTML loaded onto the client's
    computer (I'm strictly talking Web scripting here). To extend the
    limitations, IE added ActiveX to it's list of features (an ugly
    feature if you ask me... security and standard-wise)

    > Should there be a Web standard that allows us to compress code into
    > bytecode, and then send the byte code directly to the browser?
    >


    I did think about having a pre-compiled scripting standard for
    browsers, but the fact is that as computer evolves, there is less and
    less need to do so, and interpreted or executed, the speed difference
    tends to be more and more negligeable. Browser scripting will always
    be, at a level or another, interpreted. There is a long way before
    achieving performances like compiled C++ for the Web, because 1) C++
    is OS and hardware specific, 2) every browsers implements their own
    memory allocations for DOM ressources, 3) for security reasons, it is
    the browser's responsibility to handle policies, so it has to
    interpret the script whatsoever.

    As for code size, there are alternatives : code obfuscators, and code
    compressor (like here : http://javascriptcompressor.com/)

    > Perhaps there is a flaw, in the sense that bytecode is different from
    > browser to browser, but isn't that what standards are all about?
    >


    As a final note, I would hate having to recompile my Javascript files
    all the time... mostly because many of my scripts depends on other
    scripts, and HTML files.... Since there will always be things like
    <div onclick="foot();"></div> (interpreted scripts) I don't see why
    adding new "embrace and expands from Microsoft through new ways of
    handling data" will help in restoring compliancies (*grin*) KISS

    > I'd be interested in hearing the opinions of others on this subject.
    >


    Cheers !

    > Many thanks.
    >
    > Daz.


    - Yanick
     
    Yanick, May 9, 2007
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vk
    Replies:
    0
    Views:
    306
  2. jacob navia

    Statistics standard discussion

    jacob navia, Oct 22, 2005, in forum: C Programming
    Replies:
    9
    Views:
    311
    jacob navia
    Nov 2, 2005
  3. vin2ktalks
    Replies:
    0
    Views:
    314
    vin2ktalks
    Oct 10, 2006
  4. bill.wu
    Replies:
    3
    Views:
    310
    bill.wu
    Jan 14, 2008
  5. cmoller

    New to Python, Discussion Groups.

    cmoller, May 19, 2008, in forum: Python
    Replies:
    3
    Views:
    262
    Fuzzyman
    May 19, 2008
Loading...

Share This Page