为什么HTML / JavaScript / CSS不是编译语言,它们会是什么? [英] Why HTML/JavaScript/CSS are not compiled languages and will they ever be?

查看:138
本文介绍了为什么HTML / JavaScript / CSS不是编译语言,它们会是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么HTML / JavaScript / CSS不会成为编译语言(甚至可能合并为一种编译语言)?如果浏览器运行浏览器虚拟机和html / javascript / css源可以编译为浏览器字节码。



我可以看到一些挑战:


  1. 如何处理现有页面的数十亿?使这个编译是可选的,所以如果你想要可以使用纯旧的html。


  2. 搜索提供者如何索引页面?做一个反编译器,它会将字节码反编译成准确的原始源(例如像flash可以反编译)。


  3. 如何使它与所有浏览器兼容?有一个集中式开发人员(让我们说w3c)开发这个虚拟机,然后每个浏览器都会嵌入它。


但是效益如何:


  1. 速度。

  2. 尺寸。

  3. 不再有宽松和半正确HTML。



  4. b

    如果没有字节码,至少有一些原生压缩,html可能不是最有效的数据存储方式。我知道有gzip,但为什么每次在服务器上压缩页面,并在浏览器中解压缩,如果我们可以压缩一次并将其提供给浏览器?



    阻止我们走这条路(除了巨大的努力,使一切发生)吗?

    解决方案

    啊,但Javascript成为一种编译语言。使用 TraceMonkey 查看Firefox 3.5。它是疯狂的比相比um你知道谁的浏览器。这是真的,JS永远不会是C,但它是一个比C更动态的语言,并在许多方面,使它更具表达力和强大。



    至于HTML,我不认为缺乏HTML的有效性是对速度的巨大损害。我认为,把可视化表示和操作DOM的引擎需要得到更好的(um,IE,我在看你的大方向...)。 CSS合规性需要变得更好,CSS本身需要更强大。 (用CSS 3人上车)



    但我认为速度会在Firefox和Chrome上变得更好,以至于人们真的要去开始使用它进行主流应用程序开发。这很有趣。 Adobe似乎正在将Flash作为动态网页内容的平台销售,MSFT正在推出用于动态网页内容的Silverlight,而Google只想真正改进HTML和Javascript来显示动态网页内容。而且Google到目前为止做得很好,我必须说...


    Why HTML/JavaScript/CSS are not becoming compiled languages (or maybe even merge into a single compiled language)? What if browsers were running "Browser Virtual Machine" and html/javascript/css sources could by compiled to a "browser bytecode". Wouldn't it help developers and users a lot?

    I can see a few challenges:

    1. What to do with zillions of existing pages? Make this compilation optional, so if you want you can use plain old html. If you want to feed a browser with a compiled page just use .chtml for example.

    2. How search providers would index pages? Make a decompiler that would decompile bytecode into exact original sources (for example like flash can be decompiled). Or search providers can use the same virtual machine and get data they need from there.

    3. How to make it compatible with all browsers? Have one centralized developer (lets say w3c) to develop this virtual machine and then each browser would embed it.

    But what about benefits:

    1. Speed.
    2. Size.
    3. No more "loose" and "half-correct" html. It is either correct or won't compile.
    4. Looks the same in every (supported) browser.

    If not a bytecode then at least have some native compression going on, html probably is not the most efficient way of data storing. I know there is gzip but why to compress pages every time on a server and decompress in a browser if we can compress it once and feed it to a browser?

    So what stops us from taking this road (well, besides a huge amount of effort to make it all happen)?

    解决方案

    Ah, but Javascript IS becoming a compiled language. Check out Firefox 3.5 with TraceMonkey. It's insanely fast compared to um you-know-who's browser. It's true that JS will never be C, but it's a much more dynamic language than C is, and in many ways that makes it more expressive and powerful.

    As far as HTML goes, I don't think that the lack of validity of HTML is a huge detriment to speed. I think the engines that put together the visual representation and manipulate the DOM need to get a lot better (um, IE, I'm looking in your general direction...). CSS compliance needs to get better, and CSS itself needs to get more powerful. (Get on the bus with CSS 3 people!)

    But I do think that speed is going to get better on Firefox and Chrome to such an extent that people really ARE going to start using it for mainstream application development. It's funny. Adobe seems to be selling Flash as their platform for dynamic web content, MSFT is selling Silverlight for dynamic web content, and Google just wants to really improve HTML and Javascript to display dynamic web content. And Google's doing pretty well at it so far, I must say...

    这篇关于为什么HTML / JavaScript / CSS不是编译语言,它们会是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆