A suggestion for a new Web standard (Discussion)

D

Daz

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.
 
T

Tim Slattery

Daz said:
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.
 
V

Vicente Raúl Plata Fonseca [XnT]

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?
 
R

RobG

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.
 
D

Daz

Vicente Raúl Plata Fonseca [XnT] said the following on 5/8/2007 6:50 PM:


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. :)
 
D

Daz

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.

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".
 
Y

Yanick

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top