平台独立语言

发布于 2024-08-29 00:24:35 字数 1536 浏览 6 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

自在安然 2024-09-05 00:24:35

平台无关并不是一个定义完美的术语。它对不同的人来说可能意味着不同的事情。例如,有些人说 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.

时光礼记 2024-09-05 00:24:35

取决于您对平台无关的含义:

  • 可在具有相同源代码的任何平台上编译:几乎任何语言
  • 在不同平台上复制并立即运行:任何脚本语言以及具有框架的平台的 Java 和 .NET(JRE 和 .NET/单核细胞增多症)。

Depends on what you mean with platform independent:

  • compileable on any platform with the same sourcecode: Almost any language
  • Copy on a different platform and run immedatly: Any Scripting Language and Java and .NET for platforms which have the framework (JRE and .NET/mono).
长发绾君心 2024-09-05 00:24:35

Perl、php、scheme、lisp、LOLCODE。确实是大多数解释性语言。

Perl, php, scheme, lisp, LOLCODE. Most interpreted languages really.

生生漫 2024-09-05 00:24:35

列出依赖于平台的语言可能会更容易。

It might be easier to list platform-dependent languages.

℡寂寞咖啡 2024-09-05 00:24:35

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.

亚希 2024-09-05 00:24:35

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

等风来 2024-09-05 00:24:35

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.

甜`诱少女 2024-09-05 00:24:35

感谢供应商或社区,几乎每种语言都在某种程度上与平台无关。

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.

浅黛梨妆こ 2024-09-05 00:24:35

如果您指的是平台无关代码的编译器(例如用于 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).

苹果你个爱泡泡 2024-09-05 00:24:35

我的建议是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.

橘虞初梦 2024-09-05 00:24:35

如果有人为它编写一个抽象底层硬件的层来运行,那么几乎任何语言都可以成为 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文