编译Scala [英] Compilation of Scala

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

问题描述

任何人都可以告诉我Scala编译方式(或表示一些消息来源)

Can any one please tell me (or denote some source) way of compilation Scala take place.

我有一些疑问,例如

  • 在编译步骤中,Scala如何编译Java相关内容?它是否单独使用Java编译器?
  • .scala的最终字节码与Java的.class文件相同吗?
  • 由于Oracle收购了Sun,因此JVM也属于Oracle吗?
  • 如果有一天JVM获得了专有软件,那也会影响Scala吗?
  • Within compilation steps, how does Scala compile Java related stuff? Does it uses Java compiler separately?
  • Is the final bytecode of .scala the same as Java's .class file?
  • Due to Sun acquisition by Oracle, does the JVM also belong to Oracle?
  • If some day JVM got proprietary software, would that affect Scala as well?

推荐答案

  • 在编译步骤中,Scala如何编译Java相关内容?
  • Scala无法编译Java.它对Java足够了解,可以弄清楚这些类的API是什么,但仅此而已.

    Scala doesn't compile Java. It knows enough about Java to figure out what the API of the classes will be, but that's all.

    • 它是否单独使用Java编译器?

    它希望您使用Java编译器来编译Java文件.

    It expects you to compile your java files with the java compiler.

    • .scala的最终字节码是否与Java的.class文件相同?

    是的. Scala生成有效的.class文件.但是,由于有效的类文件允许Java不允许或无法表示的内容,因此无法将该文件转换为Java代码.

    Yes. Scala produces valid .class files. However, it is not possible to convert that file into Java code, since valid class files allow things that Java doesn't allow or cannot represent.

    • 由于Oracle收购了Sun,因此JVM也属于Oracle吗?

    没有"the" JVM.现有许多JVM,而Oracle实际上拥有自己的专有JVM.当然,Sun的JVM现在是Oracle的.

    There's no "the" JVM. There are many existing JVMs, and, in fact, Oracle had their own proprietary JVM. Sun's JVM is now Oracle's, of course.

    • 如果有一天JVM获得了专有软件,那也会影响Scala吗?

    一直有很多专有的JVM,其中之一来自Oracle.

    There have always been many proprietary JVMs, one of them being from Oracle.

    让我们考虑一个假想的最坏情况"场景:世界上所有的JVM都成为许可(付费)产品或不复存在.当然,Scala仍可以在Dalvik VM上运行,但让我们假设它也已付费或不存在.

    Let's consider an hypothetical "worst case" scenario: all JVMs in the world become licensed (paid) products or cease to exist. Scala would still be able to run on Dalvik VM, of course, but let's assume it also becomes paid or ceased to exist.

    在这种情况下,Scala可能会仍然继续存在,但是您必须付费才能运行用Scala编译的程序.实际上,由于Scala是JVM程序,因此即使使用编译器,您也必须付费!

    In this case, Scala could still continue to exist, but you'd have to pay to be able to run programs compiled with Scala. In fact, since Scala is a JVM program, you'd have to pay to even use the compiler!

    或者,Scala可以扩展到其他目标平台.目前,Scala采取了此类措施,但绝对没有压力使其达到生产级.如有必要,可以这样做.

    Alternatively, Scala could branch out to some other target platform. There are such efforts in Scala right now, but absolutely no pressure to make them production-grade. If necessary, it would be done.

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

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