Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(11)
平台无关并不是一个定义完美的术语。它对不同的人来说可能意味着不同的事情。例如,有些人说 C 是 PI,其他人会说不是。有时,人们会费尽心思让 C 代码与configure(1) 一起工作,以便它可以在许多不同的平台上编译。这是否意味着我们可以编写平台无关的 C,但并非所有 C 都是平台无关的?
也许 Java(+在 JVM 上运行的其他软件)被认为是 PI,因为它们定义了一个平台,并且由不同的机器来实现该平台。但它们并不总是做得正确 - 例如,某些 JVM(尤其是早期的)具有其他 JVM(在其他平台上)没有的错误。当然,您可以编写链接到本机代码的非纯 java - 当然不是独立于平台的。
一些答案表明脚本语言是独立于平台的。告诉那些编写 javascript 并希望其在 IE6、IE7、FF、Chrome、Safari 等上运行的人!
因此,您实际上应该更多地说明“平台独立”的含义,或者您为什么要问。
Platform independent isn't a perfectly well defined term. It can mean different things to different people. For example, some people have said that C is PI, others would say it isn't. Sometimes, people go to a lot of trouble to make C code work with configure(1) so that it can compile on lots of different platforms. Does that mean that one can write platform-independent-C, but not all C is platform independent?
Perhaps Java (+other software that runs on JVM) is considered PI because they define a platform, and it's up to different machines to implement that platform. But they don't always do it properly - for example, some JVMs (particularly early ones) have bugs that others (on other platforms) don't. And of course you can write non-pure java that links to native code - certainly not platform independent.
Several answers have suggested that scripting languages are platform independent. Tell that to people who write javascript and want it to work on IE6, IE7, FF, Chrome, Safari, etc!
So it's really up to you to say more about what you mean by "Platform Independent", or why you're asking.
取决于您对平台无关的含义:
Depends on what you mean with platform independent:
Perl、php、scheme、lisp、LOLCODE。确实是大多数解释性语言。
Perl, php, scheme, lisp, LOLCODE. Most interpreted languages really.
列出依赖于平台的语言可能会更容易。
It might be easier to list platform-dependent languages.
Ruby、Lisp、Scheme、Scala、Clojure、Python、Perl、PHP、C#(通过 Mono)...
老实说,这个列表还会继续增长。缩小平台无关的定义或询问哪些语言依赖于平台要容易得多。
Ruby, Lisp, Scheme, Scala, Clojure, Python, Perl, PHP, C# (via Mono)...
Honestly, the list could keep growing. It's much easier to narrow down your definition of platform independent or ask which languages ARE platform dependent.
pi 语言有很多种。你想实现什么目标?只是想学习另一种语言?或者您有一个特定的项目吗?
一些例子:
C/C++、C#、Java、Ruby、Python、Perl、PHP、Scheme、Lisp
一些有用的链接:
http://en.wikipedia.org/wiki/Lists_of_programming_languages
http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(basic_instructions)< br>
http://en.wikipedia.org/wiki/Comparison_of_programming_languages
There are a lot of p.i. languages. What do you want to achieve? Just want to learn another language? Or do you have a specific project in mind?
Some examples:
C/C++, C#, Java, Ruby, Python, Perl, PHP, Scheme, Lisp
Some useful links:
http://en.wikipedia.org/wiki/Lists_of_programming_languages
http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(basic_instructions)
http://en.wikipedia.org/wiki/Comparison_of_programming_languages
Java 是独立于平台的,因为它运行在 Java 虚拟机 (jvm) 上。还有其他运行在jvm上的语言,当然它们也是PI。斯卡拉就是一个例子。
Java is platform independent because it runs on the Java Virtual Machine (jvm). There are other languages that run on jvm, all of them are of course also PI. Scala is an example.
感谢供应商或社区,几乎每种语言都在某种程度上与平台无关。
C/C++(Boost、QT等)、C#/Java、Vala、Python/Ruby/Perl、PHP等,所有这些语言都是平台无关的,唯一的区别是有些语言是根据平台重新编译的,有些是在框架之上运行,另一些是解释语言。
Nearly every language is somehow platform independent, thanks to the vendors or the community.
C/C++ (Boost, QT, etc.), C#/Java, Vala, Python/Ruby/Perl, PHP etc. etc., all these languages are platform independent, the only difference is that some are recompiled to the according platform, some are running on top of a framework and the others are interpreted languages.
如果您指的是平台无关代码的编译器(例如用于 Java 语言的 Java VM),您可以查找 CIL/MSIL(用于 C# 和其他基于 .Net 的)和 LLVM(低级虚拟机,我想可能会找到编译器)对于 C 和 Haskell)。
If you mean compilers to platform-independant code (like Java VM for Java language) you can look for CIL/MSIL (for C# and other .Net-based) and LLVM (low-level virtual machine, I guess its possible to find compilers for C and Haskell).
我的建议是Scala。您可以在 JVM 上使用所有 Java API,并且您拥有更简洁、更强大和更干净的语言。
My suggestion is Scala. You can use all Java APIs on the JVM and you have a more concise, more powerful and cleaner language.
如果有人为它编写一个抽象底层硬件的层来运行,那么几乎任何语言都可以成为 PI。
相比之下,每个平台都需要有人编写这样一个层,然后“PI”语言才能在其上运行。
Pretty much any language can be P.I. if someone writes a layer for it to run on which abstracts the underlying hardware.
By contrast, every platform requires someone to write such a layer before the 'PI' language can run on it.