Java programmer, why do you want to focus on Scala

Source: Internet
Author: User
Tags traits

Let's take a look at Martin Odersky's design goals for the Scala language this time. In the process of creating "beyond the Java language", what do you need to take into account?

Concessions

Frank Sommers: As you mentioned earlier, you want to create a language that exists within the Java architecture and integrates with the Java infrastructure. In order to do this, what concessions does Scala make to make it compatible with the Java platform?

Martin Odersky: Luckily, we don't have to make too many compromises, or it's hard to judge that all the compromises we make are bad for us or beneficial. One of the compromises we had to make was to buy a static, overloaded model of Java. Perhaps we should be more active in trying some other methods, such as using multiple methods, although we tried this at the time, but did not fully explore the design of multi-methods. It may not have been fully explored until today, so I am not entirely sure whether this approach is going to work. This approach would have been an exciting possibility, but we didn't use it because we wanted to maintain compatibility with Java.

Another thing that sometimes leads to denial is that Scala contains both traits technology and class technology. It is thought that a neat design should be only using traits technology. There are some neat designs that use only traits to abandon class concepts, but we have not done so. Because we want to keep the interoperability with Java from these two aspects. We want a way to make it easy for Java code to invoke Scala code, and traits doesn't have a feature mapped to Java because it doesn't exist in Java at all. Therefore, we chose the concept of classes owned in Java because we wanted to be able to map backwards so that we could easily preserve interoperability in two directions.

The 3rd question is not so much a language problem as the problem of a class library. We would like to abandon the concept of NULL (NULL). Null is the source of many errors. In Scala, NULL is not allowed as a possible value for any type, instead of the option type. Of course, there are many classes in the Java class library that return null, and we have to solve this problem.

Copyright NOTICE: Welcome reprint, Hope in your reprint at the same time, add the original address, thank you with

Java programmer, why do you want to focus on Scala

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.