Free symbol is harmful

Source: Internet
Author: User

What is free variable?

"Free" is relative to "Bound ". Function parameters are "Bound" to a function; local variables/functions/classes are "Bound" to a function. A variable which is defined out of a function is "free" for this function.

 

Why is free variable harmful?

Free variables make a function depend on outside scopes. when a programer reads a function with some free variables, he/she has to go to the definition of a free variable to see what it means. furthermore, he/she will worry about whether there are other operations on this variable at somewhere else.

Personally, in terms of programming, I wocould rather to know what a function does,ExplicitlyFrom the parameters I give it. read/write operations of free variables inside a function are indeedImplicitOperations, which is like undercurrent water, you never know how it flows (unless dive in to read through all the codes ).

 

Functional programming cuts down free Variables

most functional programming controls ages do limitations on variable assignment ( side effects ). although I think it's a "hypercorrection", it does cuts down free variables. in functional programming, functions are much like State Transformations, which is quite direct and expressive. data flows are quite direct and expressive in this way.

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.