zoukankan      html  css  js  c++  java
  • Free symbol is Harmful

    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 would rather to know what a function does, explicitly from the parameters I give it. Read/Write operations of free variables inside a function are indeed implicit operations, 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 languages 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.

  • 相关阅读:
    20131001国庆作业例2-10,2-11
    20131001国庆作业例2-7,2-8,2-9
    20131001国庆作业例2-4,2-5,2-6
    20131001国庆作业第二章例2-1,2-2,2-3
    20131001国庆作业第一章例1-1
    20130930C语言作业基础练习
    编程心得4
    编程心得3
    编程心得1
    714
  • 原文地址:https://www.cnblogs.com/linghuaichong/p/3915357.html
Copyright © 2011-2022 走看看