You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Paddle/doc/design/scope.md

29 lines
788 B

8 years ago
# What is a scope.
8 years ago
8 years ago
## Overview
8 years ago
8 years ago
预期使用场景。
8 years ago
8 years ago
引出Scope的两个属性。
1. Scope是Variable的Container
2. Scope可以共享
8 years ago
8 years ago
## Scope 是一个Variable的Container
8 years ago
8 years ago
解释下为啥Scope是Variable的container。解释下面几个小点的原因。
8 years ago
8 years ago
* 他只包含variable
* 每一个variable也只属于一个Scope
* 每一个Scope析构的时候会同时析构variable
* 只能通过Scope创建Vairable。
* 只能通过Scope获取Variable。
## Scope 可以被继承或者叫共享
8 years ago
8 years ago
解释下Scope如何被共享如何查找Variable的算法。
* Scope永远从本地寻找Variable找不到会从他的父亲Scope寻找Variable
* 嵌套深度不做要求。
8 years ago
8 years ago
# 接口实现
8 years ago
# 各个接口是啥意思,为啥这么设计