问题
I was searching a bit for another platform independent language like Java.
Are there other P.I. languages?
Thanks
回答1:
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.
回答2:
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).
回答3:
It might be easier to list platform-dependent languages.
回答4:
Perl, php, scheme, lisp, LOLCODE. Most interpreted languages really.
回答5:
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.
回答6:
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.
回答7:
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
回答8:
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).
回答9:
My suggestion is Scala. You can use all Java APIs on the JVM and you have a more concise, more powerful and cleaner language.
回答10:
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.
回答11:
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.
来源:https://stackoverflow.com/questions/2607400/platform-independent-languages