Java programmers, why do you need to pay attention to Scala, Java programmers, and Scala?

Source: Internet
Author: User
Tags traits

Java programmers, why do you need to pay attention to Scala, Java programmers, and Scala?

Let's take a look at Martin Odersky's design goals for Scala. What aspects should be taken into account in the process of creating a language that surpasses Java?

Concession

Frank Sommers: You mentioned earlier that you want to create a language that exists in the Java System and integrates the Java infrastructure. To achieve this, what kind of concessions does Scala need to make it compatible with the Java platform? 

Martin Odersky: Fortunately, we don't need to make too many compromises, or it's hard to judge whether all of the compromises we 've made are negative or beneficial to us. One of the compromises we have to make is to purchase the static heavy load model of Java. Maybe we should try other methods more actively, such as using multiple methods. Although we tried this at the time, we did not fully discuss the design of multiple methods. Maybe I haven't fully discussed it until today, so I'm not sure whether this method works. This method was originally exciting, but we didn't use it because we wanted to maintain compatibility with Java.

Another thing that will sometimes lead to people's denial is that Scala includes both Traits and class technologies. We think that a clean design should only adopt the Traits technology. Currently, we have some neat designs that only use Traits and discard the class concept, but we have not done so. Because we want to retain the interoperability with Java in these two aspects. We hope there is a way for Java code to easily call Scala code, and Traits does not include the features mapped to Java, because this technology does not exist in Java. Therefore, we chose the concept of classes in Java, because we want to be able to map back, so that we can easily retain interoperability in both directions.

The 3rd problems are not so much language problems as class libraries. We would like to discard the concept of null. NULL is the root cause of many errors. In Scala, null is not allowed as a possible value of any type. Instead, it is replaced by option type ). Of course, many classes in the Java class library return null. We must solve this problem.

Copyright Disclaimer: you are welcome to reprint it. I hope you can add the original article address while reprinting it. Thank you for your cooperation.

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.