Seven weeks and seven languages (6)

Source: Internet
Author: User

Features of functional programming
1. Everything is a function and there is no object concept.
2. The same input is given to produce the same output.
3. The function has no internal status and has no side effects.

In Erlang, It inherits the features of functional programming and adds one. elang function variables can only be assigned once.

Erlang inherits the idea of PROLOG. in Prolog language, there are three elements: Atom, variable, list, And Erlang,
It also inherits its syntax and powerful pattern matching functions. These features come from
If Erlang has its own characteristics, it mainly includes the following:
1. No threads. All are lightweight processes.
No thread means no resource sharing, which greatly simplifies concurrent programming and increases the efficiency of concurrent execution. For concurrent implementation, it mainly creates a lightweight process. I'm curious about the relationship between the Process and the operating system itself.
In itself, the operating system provides processes. The process between the Lightweight Process Erlang and the operating system does not know what the relationship is, is it implemented by itself?

2. Dynamic hot plugging and high stability
Dynamic languages all have hot plug-in functions, which is the biggest advantage of dynamic languages. But Erlang seems to be compiled and executed. Can the systems that reference this module be aware of it in a timely manner?
For stability, the language core may be relatively small and the microkernel, so it is highly stable.

3. Error Handling Mechanism and Automatic Restart of processes
When an error occurs, many Java languages throw an exception through display definition or during runtime.ProgramErlang does not handle the issue. The process crashes directly and then restarts the process. It is mainly because functional programming is stateless and the retry results are the same.

As for the powerful concurrency programming model, which is the actor model, it is very similar to Scala. The sender sends messages asynchronously, and the receiver receives messages through pattern matching.

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.