lua学习笔记(二)

一、深入lua函数

  1. 一些必要的概念:

    参考自:
    https://www.douban.com/note/183992679/?type=rec#sep
    http://en.wikipedia.org/wiki/First-class_object
    http://en.wikipedia.org/wiki/Scope
    
    • 第一类值:

    In programming language design, a first-class citizen (also type,object, entity, or value) in a given programming language is an entity which supports all the operations generally available to other entities. These operations typically include being passed as an argument, returned from a function, and assigned to a variable.

    第一类值具备的特征:
    可以存放在变量和数据结构中
    可以当做参数传递给函数
    可以作为函数的返回值
    可以在运行期间被创建
    独立于给定的名字
    
    • 词法界定(静态域):

    With lexical scope, a name always refers to its (more or less) local lexical environment. This is a property of the program text and is madeindependent of the runtime call stack by the language implementation. Because this matching only requires analysis of the static program text, this type of scoping is also called static scoping.

    • 静态域和动态域的比较:

    The use of local variables — of variable names with limited scope,that only exist within a specific function — helps avoid the risk of a name collision between two identically named variables. However,there are two very different approaches to answering this question:What does it mean to be “within” a function?

    In lexical scoping (or lexical scope; also called static scoping or static scope), if a variable name’s scope is a certain function, then its scope is the program text of the function definition: within that text, the variable name exists, and is bound to the variable’s value,but outside that text, the variable name does not ex

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值