替代的JavaScript [英] Alternatives to JavaScript

查看:129
本文介绍了替代的JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,唯一完全支持的语言,并在浏览器的DOM树操纵的事实上的标准的JavaScript。它看起来像它有着深厚的设计问题,使人们错误和安全漏洞对于新手的雷区。

At the moment, the only fully supported language, and the de-facto standard for DOM tree manipulation in the browser is JavaScript. It looks like it has deep design issues that make it a minefield of bugs and security holes for the novice.

你知道的任何存在的或计划主动介绍任何形式(而不是只有JavaScript),用于下一代浏览器的DOM树的操作和HTTP请求的更好(重新设计)语言?如果是,什么是融入,比方说,Firefox的路线图,如果没有,什么原因(除了互操作性)应该是JavaScript的浏览器平台上唯一支持的语言?

Do you know of any existent or planned initiative to introduce a better (redesigned) language of any kind (not only javascript) for DOM tree manipulation and HTTP requests in next generation browsers? If yes, what is the roadmap for its integration into, say, Firefox, and if no, for what reasons (apart of interoperability) should be JavaScript the only supported language on the browser platform?

我已经使用jQuery和我也读的javascript:好的部分。事实上,这些建议都很好,但是我无法理解的是:为什么只有JavaScript?在服务器端(你最喜欢-OS平台),我们可以操纵一个DOM树的每一种语言,甚至FORTRAN。为什么客户端(浏览器平台)只支持JavaScript?

I already used jQuery and I also read "javascript: the good parts". Indeed the suggestions are good, but what I am not able to understand is: why only javascript? On the server-side (your-favourite-os platform), we can manipulate a DOM tree with every language, even fortran. Why does the client side (the browser platform) support only javascript?

推荐答案

用JavaScript的问题不是语言本身 - 这是一个非常好的原型的动态语言。如果你来自一个面向对象的背景有一个学习曲线,但它不是语言的错。

The problem with javascript is not the language itself - it's a perfectly good prototyped and dynamic language. If you come from an OO background there's a bit of a learning curve, but it's not the language's fault.

大多数人认为JavaScript是像Java,因为它有相似的语法和一个相似的名字,但实际上它更像口齿不清。它实际上是pretty非常适合于DOM操作。

Most people assume that Javascript is like Java because it has similar syntax and a similar name, but actually it's a lot more like lisp. It's actually pretty well suited to DOM manipulation.

的真正的问题是,它是由浏览器编译,这意味着它在根据客户机上的非常不同的方式。

The real problem is that it's compiled by the browser, and that means it works in a very different way depending on the client.

不仅是实际的DOM不同取决于浏览器,但有在性能和布局的巨大的差异。

Not only is the actual DOM different depending on the browser, but there's a massive difference in performance and layout.

编辑以下澄清问题

假设多间preTED语言得到了支持 - 你仍然有同样的问题。各种浏览器仍然是越野车,并有不同的DOM。

Suppose multiple interpreted languages were supported - you still have the same problems. The various browsers would still be buggy and have different DOMs.

此外,你就必须有一个跨preTER内置到浏览器中或以某种方式安装为一个插件(你可以检查你担任了页面之前)为每种语言。它花了很长时间来获取JavaScript是一致的。

In addition you would have to have an interpreter built into the browser or somehow installed as a plug in (that you could check for before you served up the page) for each language. It took ages to get Javascript consistent.

您不能以同样的方式使用编译语言 - 那么你引入了不容易被审查来实现它的可执行文件。用户的很多会选择不让它运行。

You can't use compiled languages in the same way - then you're introducing an executable that can't easily be scrutinised for what it does. Lots of users would choose not to let it run.

OK,那么怎么样某种沙箱的编译code?听起来像Java小程序给我。或ActionScript在Flash中。或C#在Silverlight。

OK, so what about some sort of sandbox for the compiled code? Sounds like Java Applets to me. Or ActionScript in Flash. Or C# in Silverlight.

有关某种IL标准是什么?有更多的潜力。在你想要的任何语言​​进行开发,然后将其编译为IL,该浏览器,然后即时编译器。

What about some kind of IL standard? That has more potential. Develop in whatever language you want and then compile it to IL, which the browser then JITs.

除,JavaScript是一种已经是IL - 只要看看 GWT 。它可以让你用Java编写的程序,但它们分HTML和JS。

Except, Javascript is kind of already that IL - just look at GWT. It lets you write programs in Java, but distribute them as HTML and JS.

编辑下面进一步澄清的问题

JavaScript是没有,或者说并没有,通过浏览器支持的唯一语言:早在Internet Explorer的黑暗时代,你可以Javascript或者VBScript之间选择,以在IE中运行。技术上IE浏览器甚至没有运行JavaScript - 它跑的JScript (主要是为了避免支付对太阳这个词的的Java 的,甲骨文还是自己名字的的JavaScript 的)。

Javascript isn't, or rather wasn't, the only language supported by browsers: back in the Internet Explorer dark ages you could choose between Javascript or VBScript to run in IE. Technically IE didn't even run Javascript - it ran JScript (mainly to avoid having to pay Sun for the word java, Oracle still own the name Javascript).

问题是VBScript的是专有的微软,还以为它只是不是很好。虽然JavaScript是增加功能,并在其他浏览器中获得最高税率调试工具(如萤火虫)VBScript中的IE仍然只和pretty多未调试的(在IE4 /开发工具5/6是没有存在的)。同时也VBScript的扩展成为操作系统中的pretty功能强大的脚本工具,但没有这些功能在浏览器是可利用的(并且当他们,他们成为庞大的安全漏洞)。

The problem was that VBScript was proprietary to Microsoft, but also that it just wasn't very good. While Javascript was adding functionality and getting top rate debugging tools in other browsers (like FireBug) VBScript remained IE-only and pretty much un-debuggable (dev tools in IE4/5/6 were none existent). Meanwhile VBScript also expanded to become a pretty powerful scripting tool in the OS, but none of those features were available in the browser (and when they were they became massive security holes).

还有一些企业内部应用程序,在那里,使用VBScript(以及一些依赖这些安全漏洞),并且他们还在运行IE7(他们只停止IE6,因为MS终于杀它关闭)。

There are still some corporate internal applications out there that use VBScript (and some rely on those security holes), and they're still running IE7 (they only stopped IE6 because MS finally killed it off).

获取Javascript功能来它的当前状态是一个噩梦,并采取了20年。它仍然没有一致的支持,语言功能(在1999年指定)从某些浏览器和大量的垫片仍下落不明被要求。

Getting Javascript to it's current state has been a nightmare and has taken 20 years. It still doesn't have consistent support, with language features (specified in 1999) still missing from some browsers and lots of shims being required.

添加在浏览器间preting替代语言面临两个主要问题:

Adding an alternate language for interpreting in browsers faces two major problems:


  • 让所有的浏览器厂商实施新的语言标准 - 的东西,他们还没有在20年的Javascript管理

  • Getting all the browser vendors to implement the new language standard - something they still haven't managed for Javascript in 20 years.

一个第二语言可能会冲淡你已经得到大家的支持,允许(例如),即有二流的JavaScript支持,但伟大的VBScript(再次)。我真的不希望被写在不同的浏览器不同的语言code。

A second language potentially dilutes the support you already have, allowing (for instance) IE to have second rate Javascript support but great VBScript (again). I really don't want to be writing code in different languages for different browsers.

应该指出的是,JavaScript是不是'完成' - 它仍在不断发展,成为新的更好的浏览器。该最新版本未来几年在浏览器的实现,他们正在处理的下一个。

It should be noted that Javascript isn't 'finished' - it's still evolving to become better in new browsers. The latest version is years ahead of of the browsers' implementations and they're working on the next one.

这篇关于替代的JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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