Is the idea of metaprogramming a new idea of programming?

Source: Internet
Author: User

The idea of metaprogramming

 

 

When I read the previous functional programming section, I saw another idea of programming, called the metaprogramming.
I think this word is very interesting. At the beginning, I thought it was the author's mistake. It should be the "Source" programming idea. After reading it carefully, the content is as follows:
According to the definition of the free encyclopedia (http://www.wikipedia.org): write some Program To generate data or Code The program used to generate the data information or code is called metaprogram. It is called metaprogramming ).
Metaprogramming is widely used in computer programming. If you have a large application with many functions including the same code, you can create a small program (such as a macro definition in C ), use it to generate these code with common functions, and spend more time to implement the important part.
Metaprogramming has many practical methods, but its core idea remains unchanged: To construct new programs with programs. It seems very advanced to construct a new program. Otherwise, the construction of a new program here only indicates that the program has new functions through a certain logical relationship.
In JavaScript, for a function, the JavaScript engine can execute it as a method and construct it as an object type. However, they are different. They have different roles in addition to their forms. The main difference is: as a function, it can be executed directly and fully utilize the context of the Function Code body, such as being convenient by applying or calling methods; being used as a constructor is greatly restricted and lacks the flexibility of functions.
In JavaScript, metaprogramming is implemented. The so-called metaprogram is function, and the data or code used for running is a series of extensions derived from function or function.
After reading this section, I found that the so-called metaprogramming is similar to functional programming. I can simply understand that metaprogramming is an extension of functional programming.

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.