Talk about Scala and go

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

The goal of GO is to replace C + + for system-level programming, Scala's goal is to replace Java for application-level development

The difference between Scala and go

Keith Morrow, a Scala supporter, published this Scala-oriented article to refute Paul Dix's article a year ago: why he prefers go over Node and Scala,paul Dix think go is better than scal A is due to the following aspects: concurrency, ease of understanding, code sharing and learning difficulties. One year after a few people retort, one because the two sides do not understand, the second may be with go writing Docker popular, the appearance of the products let everyone to go to take notice.

Keith Morrow that go is easier to learn than Scala because go is an imperative language. This is relatively easy to master for people who are not accustomed to functional languages.

Because most people are familiar with imperative languages, there is no doubt that go is easy to Scala in terms of code-sharing. So, in the school curve, the imperative language of the human learning function programming is difficult, go is a small and easy to learn language, of course, because it is closer to C and Python.

Of course the coin also has another aspect, go is because it is imperative language, it is impossible to give full play to the characteristics of functional programming, because the lack of generics, and the go language that the simple is because there is no class module generic concepts.

Keith Morrow For example: If you want to implement a simple map function, using the imperative approach (using loops instead of recursion), you must force the forgetting of type safety (such as using an empty interface), or re-implement the map function once for each type. Go does not support function overloading, except for these, go does not support read-only immutable values, except constants.

In terms of concurrency, both go and Scala have built-in concurrency mechanisms (Akka for Scala), Scala is in favor of the actor model, and go uses the CSP model, and Akka's advantage over go internal concurrency mechanism is transparency, The ability to transparently migrate actors from one machine to another to deliver messages remotely and to control reliability, while Go's goroutines and channel are forced into a single process that requires extra effort to expand and cannot be expanded so transparently. (Some people disagree that gocircuit for go is more flexible than Akka)

In short, Keith morrow that if you don't understand the benefits of functional programming and type-safe programming languages, there's no basic function structure such as immutability, it's hard to write a bug-free, secure application.

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.