diff --git a/CNAME b/CNAME old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/Using Swift with Cocoa and ObjectiveC/02Interoperability/01Interacting with Objective-C APIs.md b/Using Swift with Cocoa and ObjectiveC/02Interoperability/01Interacting with Objective-C APIs.md old mode 100644 new mode 100755 diff --git a/Using Swift with Cocoa and ObjectiveC/03Mix and Match/DAG_2x.png b/Using Swift with Cocoa and ObjectiveC/03Mix and Match/DAG_2x.png old mode 100644 new mode 100755 diff --git a/Using Swift with Cocoa and ObjectiveC/03Mix and Match/Swift and Objective-C in the Same Project.md b/Using Swift with Cocoa and ObjectiveC/03Mix and Match/Swift and Objective-C in the Same Project.md old mode 100644 new mode 100755 diff --git a/Using Swift with Cocoa and ObjectiveC/03Mix and Match/bridgingheader_2x.png b/Using Swift with Cocoa and ObjectiveC/03Mix and Match/bridgingheader_2x.png old mode 100644 new mode 100755 diff --git a/change_cdn.py b/change_cdn.py old mode 100644 new mode 100755 diff --git a/chapter1/01_swift.html b/chapter1/01_swift.html old mode 100644 new mode 100755 diff --git a/chapter1/02_a_swift_tour.html b/chapter1/02_a_swift_tour.html old mode 100644 new mode 100755 diff --git a/chapter1/chapter1.html b/chapter1/chapter1.html old mode 100644 new mode 100755 diff --git a/chapter2/01_The_Basics.html b/chapter2/01_The_Basics.html old mode 100644 new mode 100755 diff --git a/chapter2/02_Basic_Operators.html b/chapter2/02_Basic_Operators.html old mode 100644 new mode 100755 diff --git a/chapter2/03_Strings_and_Characters.html b/chapter2/03_Strings_and_Characters.html old mode 100644 new mode 100755 diff --git a/chapter2/04_Collection_Types.html b/chapter2/04_Collection_Types.html old mode 100644 new mode 100755 diff --git a/chapter2/05_Control_Flow.html b/chapter2/05_Control_Flow.html old mode 100644 new mode 100755 diff --git a/chapter2/06_Functions.html b/chapter2/06_Functions.html old mode 100644 new mode 100755 diff --git a/chapter2/07_Closures.html b/chapter2/07_Closures.html old mode 100644 new mode 100755 diff --git a/chapter2/08_Enumerations.html b/chapter2/08_Enumerations.html old mode 100644 new mode 100755 diff --git a/chapter2/09_Classes_and_Structures.html b/chapter2/09_Classes_and_Structures.html old mode 100644 new mode 100755 diff --git a/chapter2/10_Properties.html b/chapter2/10_Properties.html old mode 100644 new mode 100755 diff --git a/chapter2/11_Methods.html b/chapter2/11_Methods.html old mode 100644 new mode 100755 diff --git a/chapter2/12_Subscripts.html b/chapter2/12_Subscripts.html old mode 100644 new mode 100755 diff --git a/chapter2/13_Inheritance.html b/chapter2/13_Inheritance.html old mode 100644 new mode 100755 diff --git a/chapter2/14_Initialization.html b/chapter2/14_Initialization.html old mode 100644 new mode 100755 diff --git a/chapter2/15_Deinitialization.html b/chapter2/15_Deinitialization.html old mode 100644 new mode 100755 diff --git a/chapter2/16_Automatic_Reference_Counting.html b/chapter2/16_Automatic_Reference_Counting.html old mode 100644 new mode 100755 diff --git a/chapter2/17_Optional_Chaining.html b/chapter2/17_Optional_Chaining.html old mode 100644 new mode 100755 diff --git a/chapter2/18_Type_Casting.html b/chapter2/18_Type_Casting.html old mode 100644 new mode 100755 diff --git a/chapter2/19_Nested_Types.html b/chapter2/19_Nested_Types.html old mode 100644 new mode 100755 diff --git a/chapter2/20_Extensions.html b/chapter2/20_Extensions.html old mode 100644 new mode 100755 diff --git a/chapter2/21_Protocols.html b/chapter2/21_Protocols.html old mode 100644 new mode 100755 diff --git a/chapter2/22_Generics.html b/chapter2/22_Generics.html old mode 100644 new mode 100755 diff --git a/chapter2/23_Advanced_Operators.html b/chapter2/23_Advanced_Operators.html old mode 100644 new mode 100755 diff --git a/chapter2/chapter2.html b/chapter2/chapter2.html old mode 100644 new mode 100755 diff --git a/chapter3/01_About_the_Language_Reference.html b/chapter3/01_About_the_Language_Reference.html old mode 100644 new mode 100755 diff --git a/chapter3/02_Lexical_Structure.html b/chapter3/02_Lexical_Structure.html old mode 100644 new mode 100755 diff --git a/chapter3/03_Types.html b/chapter3/03_Types.html old mode 100644 new mode 100755 diff --git a/chapter3/04_Expressions.html b/chapter3/04_Expressions.html old mode 100644 new mode 100755 diff --git a/chapter3/05_Declarations.html b/chapter3/05_Declarations.html old mode 100644 new mode 100755 diff --git a/chapter3/06_Attributes.html b/chapter3/06_Attributes.html old mode 100644 new mode 100755 diff --git a/chapter3/07_Patterns.html b/chapter3/07_Patterns.html old mode 100644 new mode 100755 diff --git a/chapter3/08_Generic_Parameters_and_Arguments.html b/chapter3/08_Generic_Parameters_and_Arguments.html old mode 100644 new mode 100755 diff --git a/chapter3/09_Summary_of_the_Grammar.html b/chapter3/09_Summary_of_the_Grammar.html old mode 100644 new mode 100755 diff --git a/chapter3/10_Statements.html b/chapter3/10_Statements.html old mode 100644 new mode 100755 diff --git a/chapter3/chapter3.html b/chapter3/chapter3.html old mode 100644 new mode 100755 diff --git a/gitbook/app.js b/gitbook/app.js old mode 100644 new mode 100755 diff --git a/gitbook/fonts/anonymouspro/400.woff b/gitbook/fonts/anonymouspro/400.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/anonymouspro/400i.woff b/gitbook/fonts/anonymouspro/400i.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/anonymouspro/700.woff b/gitbook/fonts/anonymouspro/700.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/anonymouspro/700i.woff b/gitbook/fonts/anonymouspro/700i.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/ebgaramond/400.woff b/gitbook/fonts/ebgaramond/400.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/ebgaramond/400i.woff b/gitbook/fonts/ebgaramond/400i.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/fontawesome/FontAwesome.otf b/gitbook/fonts/fontawesome/FontAwesome.otf old mode 100644 new mode 100755 diff --git a/gitbook/fonts/fontawesome/fontawesome-webfont.eot b/gitbook/fonts/fontawesome/fontawesome-webfont.eot old mode 100644 new mode 100755 diff --git a/gitbook/fonts/fontawesome/fontawesome-webfont.svg b/gitbook/fonts/fontawesome/fontawesome-webfont.svg old mode 100644 new mode 100755 diff --git a/gitbook/fonts/fontawesome/fontawesome-webfont.ttf b/gitbook/fonts/fontawesome/fontawesome-webfont.ttf old mode 100644 new mode 100755 diff --git a/gitbook/fonts/fontawesome/fontawesome-webfont.woff b/gitbook/fonts/fontawesome/fontawesome-webfont.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/merriweather/250.woff b/gitbook/fonts/merriweather/250.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/merriweather/250i.woff b/gitbook/fonts/merriweather/250i.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/merriweather/400.woff b/gitbook/fonts/merriweather/400.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/merriweather/400i.woff b/gitbook/fonts/merriweather/400i.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/merriweather/700.woff b/gitbook/fonts/merriweather/700.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/merriweather/700i.woff b/gitbook/fonts/merriweather/700i.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/merriweather/900.woff b/gitbook/fonts/merriweather/900.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/merriweather/900i.woff b/gitbook/fonts/merriweather/900i.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/opensans/300.woff b/gitbook/fonts/opensans/300.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/opensans/300i.woff b/gitbook/fonts/opensans/300i.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/opensans/400.woff b/gitbook/fonts/opensans/400.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/opensans/400i.woff b/gitbook/fonts/opensans/400i.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/opensans/600.woff b/gitbook/fonts/opensans/600.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/opensans/600i.woff b/gitbook/fonts/opensans/600i.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/opensans/700.woff b/gitbook/fonts/opensans/700.woff old mode 100644 new mode 100755 diff --git a/gitbook/fonts/opensans/700i.woff b/gitbook/fonts/opensans/700i.woff old mode 100644 new mode 100755 diff --git a/gitbook/images/favicon.ico b/gitbook/images/favicon.ico old mode 100644 new mode 100755 diff --git a/gitbook/jsrepl/engines/javascript-default.js b/gitbook/jsrepl/engines/javascript-default.js old mode 100644 new mode 100755 diff --git a/gitbook/jsrepl/jsrepl.js b/gitbook/jsrepl/jsrepl.js old mode 100644 new mode 100755 diff --git a/gitbook/jsrepl/langs/javascript/jsrepl_js.js b/gitbook/jsrepl/langs/javascript/jsrepl_js.js old mode 100644 new mode 100755 diff --git a/gitbook/jsrepl/sandbox.html b/gitbook/jsrepl/sandbox.html old mode 100644 new mode 100755 diff --git a/gitbook/jsrepl/sandbox.js b/gitbook/jsrepl/sandbox.js old mode 100644 new mode 100755 diff --git a/gitbook/plugins/gitbook-plugin-mathjax/plugin.js b/gitbook/plugins/gitbook-plugin-mathjax/plugin.js old mode 100644 new mode 100755 diff --git a/gitbook/plugins/gitbook-plugin-mixpanel/plugin.js b/gitbook/plugins/gitbook-plugin-mixpanel/plugin.js old mode 100644 new mode 100755 diff --git a/gitbook/print.css b/gitbook/print.css old mode 100644 new mode 100755 diff --git a/gitbook/style.css b/gitbook/style.css old mode 100644 new mode 100755 diff --git a/googleb0a4f5a22e9cb82f.html b/googleb0a4f5a22e9cb82f.html old mode 100644 new mode 100755 diff --git a/index.html b/index.html old mode 100644 new mode 100755 diff --git a/manifest.appcache b/manifest.appcache old mode 100644 new mode 100755 diff --git a/search_index.json b/search_index.json old mode 100644 new mode 100755 diff --git a/source/.DS_Store b/source/.DS_Store old mode 100644 new mode 100755 diff --git a/source/README.md b/source/README.md old mode 100644 new mode 100755 diff --git a/source/SUMMARY.md b/source/SUMMARY.md old mode 100644 new mode 100755 index c6648ad6..7941f129 --- a/source/SUMMARY.md +++ b/source/SUMMARY.md @@ -15,7 +15,7 @@ * [类和结构体](chapter2/09_Classes_and_Structures.md) * [属性](chapter2/10_Properties.md) * [方法](chapter2/11_Methods.md) - * [附属脚本](chapter2/12_Subscripts.md) + * [下标脚本](chapter2/12_Subscripts.md) * [继承](chapter2/13_Inheritance.md) * [构造过程](chapter2/14_Initialization.md) * [析构过程](chapter2/15_Deinitialization.md) diff --git a/source/chapter1/01_swift.md b/source/chapter1/01_swift.md old mode 100644 new mode 100755 diff --git a/source/chapter1/02_a_swift_tour.md b/source/chapter1/02_a_swift_tour.md old mode 100644 new mode 100755 index 7fe1554a..5785147e --- a/source/chapter1/02_a_swift_tour.md +++ b/source/chapter1/02_a_swift_tour.md @@ -12,7 +12,7 @@ - [函数和闭包(Functions and Closures)](#functions_and_closures) - [对象和类(Objects and Classes)](#objects_and_classes) - [枚举和结构体(Enumerations and Structures)](#enumerations_and_structures) -- [接口和扩展(Protocols and Extensions)](#protocols_and_extensions) +- [协议和扩展(Protocols and Extensions)](#protocols_and_extensions) - [泛型(Generics)](#generics) 通常来说,编程语言教程中的第一个程序应该在屏幕上打印“Hello, world”。在 Swift 中,可以用一行代码实现: @@ -623,9 +623,9 @@ 注意如何从`ServerResponse`中提取日升和日落时间。 -## 接口和扩展 +## 协议和扩展 -使用`protocol`来声明一个接口。 +使用`protocol`来声明一个协议。 ```swift protocol ExampleProtocol { @@ -634,7 +634,7 @@ } ``` -类、枚举和结构体都可以实现接口。 +类、枚举和结构体都可以实现协议。 ```swift class SimpleClass: ExampleProtocol { @@ -661,7 +661,7 @@ > 练习: > -> 写一个实现这个接口的枚举。 +> 写一个实现这个协议的枚举。 注意声明`SimpleStructure`时候`mutating`关键字用来标记一个会修改结构体的方法。`SimpleClass`的声明不需要标记任何方法因为类中的方法经常会修改类。 @@ -683,7 +683,7 @@ > > 给`Double`类型写一个扩展,添加`absoluteValue`功能。 -你可以像使用其他命名类型一样使用接口名——例如,创建一个有不同类型但是都实现一个接口的对象集合。当你处理类型是接口的值时,接口外定义的方法不可用。 +你可以像使用其他命名类型一样使用协议名——例如,创建一个有不同类型但是都实现一个协议的对象集合。当你处理类型是协议的值时,协议外定义的方法不可用。 ```swift let protocolValue: ExampleProtocol = a @@ -691,7 +691,7 @@ // protocolValue.anotherProperty // Uncomment to see the error ``` -即使`protocolValue`变量运行时的类型是`simpleClass`,编译器会把它的类型当做`ExampleProtocol`。这表示你不能调用类在它实现的接口之外实现的方法或者属性。 +即使`protocolValue`变量运行时的类型是`simpleClass`,编译器会把它的类型当做`ExampleProtocol`。这表示你不能调用类在它实现的协议之外实现的方法或者属性。 ## 泛型 @@ -741,4 +741,4 @@ > > 修改`anyCommonElements`函数来创建一个函数,返回一个数组,内容是两个序列的共有元素。 -简单起见,你可以忽略`where`,只在冒号后面写接口或者类名。` `和``是等价的。 +简单起见,你可以忽略`where`,只在冒号后面写协议或者类名。` `和``是等价的。 diff --git a/source/chapter1/chapter1.md b/source/chapter1/chapter1.md old mode 100644 new mode 100755 diff --git a/source/chapter2/01_The_Basics.md b/source/chapter2/01_The_Basics.md old mode 100644 new mode 100755 diff --git a/source/chapter2/02_Basic_Operators.md b/source/chapter2/02_Basic_Operators.md old mode 100644 new mode 100755 diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md old mode 100644 new mode 100755 diff --git a/source/chapter2/04_Collection_Types.md b/source/chapter2/04_Collection_Types.md old mode 100644 new mode 100755 diff --git a/source/chapter2/05_Control_Flow.md b/source/chapter2/05_Control_Flow.md old mode 100644 new mode 100755 diff --git a/source/chapter2/06_Functions.md b/source/chapter2/06_Functions.md old mode 100644 new mode 100755 index 0e3fb9b8..4c7fea36 --- a/source/chapter2/06_Functions.md +++ b/source/chapter2/06_Functions.md @@ -471,7 +471,7 @@ println("Result: \(mathFunction(2, 3))") // prints "Result: 6" ``` -就像其他类型一样,当赋值一个函数给常量或变量时,你可以让 Swift 来推测其函数类型: +就像其他类型一样,当赋值一个函数给常量或变量时,你可以让 Swift 来推断其函数类型: ```swift let anotherMathFunction = addTwoInts diff --git a/source/chapter2/07_Closures.md b/source/chapter2/07_Closures.md old mode 100644 new mode 100755 diff --git a/source/chapter2/08_Enumerations.md b/source/chapter2/08_Enumerations.md old mode 100644 new mode 100755 diff --git a/source/chapter2/09_Classes_and_Structures.md b/source/chapter2/09_Classes_and_Structures.md old mode 100644 new mode 100755 index 7553319d..5c514811 --- a/source/chapter2/09_Classes_and_Structures.md +++ b/source/chapter2/09_Classes_and_Structures.md @@ -26,12 +26,12 @@ Swift 中类和结构体有很多共同点。共同处在于: * 定义属性用于储存值 * 定义方法用于提供功能 -* 定义附属脚本用于访问值 +* 定义下标脚本用于访问值 * 定义构造器用于生成初始化值 * 通过扩展以增加默认实现的功能 * 符合协议以对某类提供标准功能 -更多信息请参见 [属性](10_Properties.html),[方法](11_Methods.html),[附属脚本](12_Subscripts.html),[初始过程](14_Initialization.html),[扩展](20_Extensions.html),和[协议](21_Protocols.html)。 +更多信息请参见 [属性](10_Properties.html),[方法](11_Methods.html),[下标脚本](12_Subscripts.html),[初始过程](14_Initialization.html),[扩展](20_Extensions.html),和[协议](21_Protocols.html)。 与结构体相比,类还有如下的附加功能: diff --git a/source/chapter2/10_Properties.md b/source/chapter2/10_Properties.md old mode 100644 new mode 100755 diff --git a/source/chapter2/11_Methods.md b/source/chapter2/11_Methods.md old mode 100644 new mode 100755 diff --git a/source/chapter2/12_Subscripts.md b/source/chapter2/12_Subscripts.md old mode 100644 new mode 100755 index 21af3d06..d37da82b --- a/source/chapter2/12_Subscripts.md +++ b/source/chapter2/12_Subscripts.md @@ -3,25 +3,25 @@ > 校对:zq54zquan -# 附属脚本(Subscripts) +# 下标脚本(Subscripts) ----------------- 本页包含内容: -- [附属脚本语法](#subscript_syntax) -- [附属脚本用法](#subscript_usage) -- [附属脚本选项](#subscript_options) +- [下标脚本语法](#subscript_syntax) +- [下标脚本用法](#subscript_usage) +- [下标脚本选项](#subscript_options) -*附属脚本* 可以定义在类(Class)、结构体(structure)和枚举(enumeration)这些目标中,可以认为是访问对象、集合或序列的快捷方式,不需要再调用实例的特定的赋值和访问方法。举例来说,用附属脚本访问一个数组(Array)实例中的元素可以这样写 `someArray[index]` ,访问字典(Dictionary)实例中的元素可以这样写 `someDictionary[key]`。 +*下标脚本* 可以定义在类(Class)、结构体(structure)和枚举(enumeration)这些目标中,可以认为是访问对象、集合或序列的快捷方式,不需要再调用实例的特定的赋值和访问方法。举例来说,用下标脚本访问一个数组(Array)实例中的元素可以这样写 `someArray[index]` ,访问字典(Dictionary)实例中的元素可以这样写 `someDictionary[key]`。 -对于同一个目标可以定义多个附属脚本,通过索引值类型的不同来进行重载,而且索引值的个数可以是多个。 +对于同一个目标可以定义多个下标脚本,通过索引值类型的不同来进行重载,而且索引值的个数可以是多个。 -> 译者:这里附属脚本重载在本小节中原文并没有任何演示 +> 译者:这里下标脚本重载在本小节中原文并没有任何演示 -## 附属脚本语法 +## 下标脚本语法 -附属脚本允许你通过在实例后面的方括号中传入一个或者多个的索引值来对实例进行访问和赋值。语法类似于实例方法和计算型属性的混合。与定义实例方法类似,定义附属脚本使用`subscript`关键字,显式声明入参(一个或多个)和返回类型。与实例方法不同的是附属脚本可以设定为读写或只读。这种方式又有点像计算型属性的getter和setter: +下标脚本允许你通过在实例后面的方括号中传入一个或者多个的索引值来对实例进行访问和赋值。语法类似于实例方法和计算型属性的混合。与定义实例方法类似,定义下标脚本使用`subscript`关键字,显式声明入参(一个或多个)和返回类型。与实例方法不同的是下标脚本可以设定为读写或只读。这种方式又有点像计算型属性的getter和setter: ``` subscript(index: Int) -> Int { @@ -35,7 +35,7 @@ subscript(index: Int) -> Int { } ``` -`newValue`的类型必须和附属脚本定义的返回类型相同。与计算型属性相同的是set的入参声明`newValue`就算不写,在set代码块中依然可以使用默认的`newValue`这个变量来访问新赋的值。 +`newValue`的类型必须和下标脚本定义的返回类型相同。与计算型属性相同的是set的入参声明`newValue`就算不写,在set代码块中依然可以使用默认的`newValue`这个变量来访问新赋的值。 与只读计算型属性一样,可以直接将原本应该写在`get`代码块中的代码写在`subscript`中: @@ -45,7 +45,7 @@ subscript(index: Int) -> Int { } ``` -下面代码演示了一个在`TimesTable`结构体中使用只读附属脚本的用法,该结构体用来展示传入整数的*n*倍。 +下面代码演示了一个在`TimesTable`结构体中使用只读下标脚本的用法,该结构体用来展示传入整数的*n*倍。 ``` struct TimesTable { @@ -61,41 +61,41 @@ println("3的6倍是\(threeTimesTable[6])") 在上例中,通过`TimesTable`结构体创建了一个用来表示索引值三倍的实例。数值`3`作为结构体`构造函数`入参初始化实例成员`multiplier`。 -你可以通过附属脚本来得到结果,比如`threeTimesTable[6]`。这条语句访问了`threeTimesTable`的第六个元素,返回`6`的`3`倍即`18`。 +你可以通过下标脚本来得到结果,比如`threeTimesTable[6]`。这条语句访问了`threeTimesTable`的第六个元素,返回`6`的`3`倍即`18`。 >注意: > -> `TimesTable`例子是基于一个固定的数学公式。它并不适合开放写权限来对`threeTimesTable[someIndex]`进行赋值操作,这也是为什么附属脚本只定义为只读的原因。 +> `TimesTable`例子是基于一个固定的数学公式。它并不适合开放写权限来对`threeTimesTable[someIndex]`进行赋值操作,这也是为什么下标脚本只定义为只读的原因。 -## 附属脚本用法 +## 下标脚本用法 -根据使用场景不同附属脚本也具有不同的含义。通常附属脚本是用来访问集合(collection),列表(list)或序列(sequence)中元素的快捷方式。你可以在你自己特定的类或结构体中自由的实现附属脚本来提供合适的功能。 +根据使用场景不同下标脚本也具有不同的含义。通常下标脚本是用来访问集合(collection),列表(list)或序列(sequence)中元素的快捷方式。你可以在你自己特定的类或结构体中自由的实现下标脚本来提供合适的功能。 -例如,Swift 的字典(Dictionary)实现了通过附属脚本来对其实例中存放的值进行存取操作。在附属脚本中使用和字典索引相同类型的值,并且把一个字典值类型的值赋值给这个附属脚本来为字典设值: +例如,Swift 的字典(Dictionary)实现了通过下标脚本来对其实例中存放的值进行存取操作。在下标脚本中使用和字典索引相同类型的值,并且把一个字典值类型的值赋值给这个下标脚本来为字典设值: ``` var numberOfLegs = ["spider": 8, "ant": 6, "cat": 4] numberOfLegs["bird"] = 2 ``` -上例定义一个名为`numberOfLegs`的变量并用一个字典字面量初始化出了包含三对键值的字典实例。`numberOfLegs`的字典存放值类型推断为`Dictionary`。字典实例创建完成之后通过附属脚本的方式将整型值`2`赋值到字典实例的索引为`bird`的位置中。 +上例定义一个名为`numberOfLegs`的变量并用一个字典字面量初始化出了包含三对键值的字典实例。`numberOfLegs`的字典存放值类型推断为`Dictionary`。字典实例创建完成之后通过下标脚本的方式将整型值`2`赋值到字典实例的索引为`bird`的位置中。 -更多关于字典(Dictionary)附属脚本的信息请参考[读取和修改字典](../chapter2/04_Collection_Types.html) +更多关于字典(Dictionary)下标脚本的信息请参考[读取和修改字典](../chapter2/04_Collection_Types.html) > 注意: > -> Swift 中字典的附属脚本实现中,在`get`部分返回值是`Int?`,上例中的`numberOfLegs`字典通过附属脚本返回的是一个`Int?`或者说“可选的int”,不是每个字典的索引都能得到一个整型值,对于没有设过值的索引的访问返回的结果就是`nil`;同样想要从字典实例中删除某个索引下的值也只需要给这个索引赋值为`nil`即可。 +> Swift 中字典的下标脚本实现中,在`get`部分返回值是`Int?`,上例中的`numberOfLegs`字典通过下标脚本返回的是一个`Int?`或者说“可选的int”,不是每个字典的索引都能得到一个整型值,对于没有设过值的索引的访问返回的结果就是`nil`;同样想要从字典实例中删除某个索引下的值也只需要给这个索引赋值为`nil`即可。 -## 附属脚本选项 +## 下标脚本选项 -附属脚本允许任意数量的入参索引,并且每个入参类型也没有限制。附属脚本的返回值也可以是任何类型。附属脚本可以使用变量参数和可变参数,但使用写入读出(in-out)参数或给参数设置默认值都是不允许的。 +下标脚本允许任意数量的入参索引,并且每个入参类型也没有限制。下标脚本的返回值也可以是任何类型。下标脚本可以使用变量参数和可变参数,但使用写入读出(in-out)参数或给参数设置默认值都是不允许的。 -一个类或结构体可以根据自身需要提供多个附属脚本实现,在定义附属脚本时通过入参个类型进行区分,使用附属脚本时会自动匹配合适的附属脚本实现运行,这就是*附属脚本的重载*。 +一个类或结构体可以根据自身需要提供多个下标脚本实现,在定义下标脚本时通过入参个类型进行区分,使用下标脚本时会自动匹配合适的下标脚本实现运行,这就是*下标脚本的重载*。 -一个附属脚本入参是最常见的情况,但只要有合适的场景也可以定义多个附属脚本入参。如下例定义了一个`Matrix`结构体,将呈现一个`Double`类型的二维矩阵。`Matrix`结构体的附属脚本需要两个整型参数: +一个下标脚本入参是最常见的情况,但只要有合适的场景也可以定义多个下标脚本入参。如下例定义了一个`Matrix`结构体,将呈现一个`Double`类型的二维矩阵。`Matrix`结构体的下标脚本需要两个整型参数: ``` struct Matrix { @@ -141,7 +141,7 @@ row0 [0.0, 0.0, row1 0.0, 0.0] ``` -将值赋给带有`row`和`column`附属脚本的`matrix`实例表达式可以完成赋值操作,附属脚本入参使用逗号分割 +将值赋给带有`row`和`column`下标脚本的`matrix`实例表达式可以完成赋值操作,下标脚本入参使用逗号分割 ``` matrix[0, 1] = 1.5 @@ -155,7 +155,7 @@ matrix[1, 0] = 3.2 3.2, 0.0] ``` -`Matrix`附属脚本的`getter`和`setter`中同时调用了附属脚本入参的`row`和`column`是否有效的判断。为了方便进行断言,`Matrix`包含了一个名为`indexIsValid`的成员方法,用来确认入参的`row`或`column`值是否会造成数组越界: +`Matrix`下标脚本的`getter`和`setter`中同时调用了下标脚本入参的`row`和`column`是否有效的判断。为了方便进行断言,`Matrix`包含了一个名为`indexIsValid`的成员方法,用来确认入参的`row`或`column`值是否会造成数组越界: ``` func indexIsValidForRow(row: Int, column: Int) -> Bool { @@ -163,7 +163,7 @@ func indexIsValidForRow(row: Int, column: Int) -> Bool { } ``` -断言在附属脚本越界时触发: +断言在下标脚本越界时触发: ``` let someValue = matrix[2, 2] diff --git a/source/chapter2/13_Inheritance.md b/source/chapter2/13_Inheritance.md old mode 100644 new mode 100755 index 69c91a17..f30a260d --- a/source/chapter2/13_Inheritance.md +++ b/source/chapter2/13_Inheritance.md @@ -14,7 +14,7 @@ 一个类可以*继承(inherit)*另一个类的方法(methods),属性(property)和其它特性。当一个类继承其它类时,继承类叫*子类(subclass)*,被继承类叫*超类(或父类,superclass)*。在 Swift 中,继承是区分「类」与其它类型的一个基本特征。 -在 Swift 中,类可以调用和访问超类的方法,属性和附属脚本(subscripts),并且可以重写(override)这些方法,属性和附属脚本来优化或修改它们的行为。Swift 会检查你的重写定义在超类中是否有匹配的定义,以此确保你的重写行为是正确的。 +在 Swift 中,类可以调用和访问超类的方法,属性和下标脚本(subscripts),并且可以重写(override)这些方法,属性和下标脚本来优化或修改它们的行为。Swift 会检查你的重写定义在超类中是否有匹配的定义,以此确保你的重写行为是正确的。 可以为类中继承来的属性添加属性观察器(property observer),这样一来,当属性值改变时,类就会被通知到。可以为任何属性添加属性观察器,无论它原本被定义为存储型属性(stored property)还是计算型属性(computed property)。 @@ -139,21 +139,21 @@ println("Tandem: \(tandem.description())") ## 重写(Overriding) -子类可以为继承来的实例方法(instance method),类方法(class method),实例属性(instance property),或附属脚本(subscript)提供自己定制的实现(implementation)。我们把这种行为叫*重写(overriding)*。 +子类可以为继承来的实例方法(instance method),类方法(class method),实例属性(instance property),或下标脚本(subscript)提供自己定制的实现(implementation)。我们把这种行为叫*重写(overriding)*。 如果要重写某个特性,你需要在重写定义的前面加上`override`关键字。这么做,你就表明了你是想提供一个重写版本,而非错误地提供了一个相同的定义。意外的重写行为可能会导致不可预知的错误,任何缺少`override`关键字的重写都会在编译时被诊断为错误。 `override`关键字会提醒 Swift 编译器去检查该类的超类(或其中一个父类)是否有匹配重写版本的声明。这个检查可以确保你的重写定义是正确的。 -### 访问超类的方法,属性及附属脚本 +### 访问超类的方法,属性及下标脚本 -当你在子类中重写超类的方法,属性或附属脚本时,有时在你的重写版本中使用已经存在的超类实现会大有裨益。比如,你可以优化已有实现的行为,或在一个继承来的变量中存储一个修改过的值。 +当你在子类中重写超类的方法,属性或下标脚本时,有时在你的重写版本中使用已经存在的超类实现会大有裨益。比如,你可以优化已有实现的行为,或在一个继承来的变量中存储一个修改过的值。 -在合适的地方,你可以通过使用`super`前缀来访问超类版本的方法,属性或附属脚本: +在合适的地方,你可以通过使用`super`前缀来访问超类版本的方法,属性或下标脚本: * 在方法`someMethod`的重写实现中,可以通过`super.someMethod()`来调用超类版本的`someMethod`方法。 * 在属性`someProperty`的 getter 或 setter 的重写实现中,可以通过`super.someProperty`来访问超类版本的`someProperty`属性。 -* 在附属脚本的重写实现中,可以通过`super[someIndex]`来访问超类版本中的相同附属脚本。 +* 在下标脚本的重写实现中,可以通过`super[someIndex]`来访问超类版本中的相同下标脚本。 ### 重写方法 @@ -266,8 +266,8 @@ println("AutomaticCar: \(automatic.description())") ## 防止重写 -你可以通过把方法,属性或附属脚本标记为*`final`*来防止它们被重写,只需要在声明关键字前加上`@final`特性即可。(例如:`@final var`, `@final func`, `@final class func`, 以及 `@final subscript`) +你可以通过把方法,属性或下标脚本标记为*`final`*来防止它们被重写,只需要在声明关键字前加上`@final`特性即可。(例如:`@final var`, `@final func`, `@final class func`, 以及 `@final subscript`) -如果你重写了`final`方法,属性或附属脚本,在编译时会报错。在扩展中,你添加到类里的方法,属性或附属脚本也可以在扩展的定义里标记为 final。 +如果你重写了`final`方法,属性或下标脚本,在编译时会报错。在扩展中,你添加到类里的方法,属性或下标脚本也可以在扩展的定义里标记为 final。 你可以通过在关键字`class`前添加`@final`特性(`@final class`)来将整个类标记为 final 的,这样的类是不可被继承的,否则会报编译错误。 diff --git a/source/chapter2/14_Initialization.md b/source/chapter2/14_Initialization.md old mode 100644 new mode 100755 diff --git a/source/chapter2/15_Deinitialization.md b/source/chapter2/15_Deinitialization.md old mode 100644 new mode 100755 diff --git a/source/chapter2/16_Automatic_Reference_Counting.md b/source/chapter2/16_Automatic_Reference_Counting.md old mode 100644 new mode 100755 diff --git a/source/chapter2/17_Optional_Chaining.md b/source/chapter2/17_Optional_Chaining.md old mode 100644 new mode 100755 diff --git a/source/chapter2/18_Type_Casting.md b/source/chapter2/18_Type_Casting.md old mode 100644 new mode 100755 diff --git a/source/chapter2/19_Nested_Types.md b/source/chapter2/19_Nested_Types.md old mode 100644 new mode 100755 diff --git a/source/chapter2/20_Extensions.md b/source/chapter2/20_Extensions.md old mode 100644 new mode 100755 index 1108be7a..27269f41 --- a/source/chapter2/20_Extensions.md +++ b/source/chapter2/20_Extensions.md @@ -23,7 +23,7 @@ Swift 中的扩展可以: - 提供新的构造器 - 定义下标 - 定义和使用新的嵌套类型 -- 使一个已有类型符合某个接口 +- 使一个已有类型符合某个协议 >注意: @@ -41,7 +41,7 @@ extension SomeType { } ``` -一个扩展可以扩展一个已有类型,使其能够适配一个或多个协议(protocol)。当这种情况发生时,接口的名字应该完全按照类或结构体的名字的方式进行书写: +一个扩展可以扩展一个已有类型,使其能够适配一个或多个协议(protocol)。当这种情况发生时,协议的名字应该完全按照类或结构体的名字的方式进行书写: ``` extension SomeType: SomeProtocol, AnotherProctocol { diff --git a/source/chapter2/21_Protocols.md b/source/chapter2/21_Protocols.md old mode 100644 new mode 100755 diff --git a/source/chapter2/22_Generics.md b/source/chapter2/22_Generics.md old mode 100644 new mode 100755 diff --git a/source/chapter2/23_Advanced_Operators.md b/source/chapter2/23_Advanced_Operators.md old mode 100644 new mode 100755 diff --git a/source/chapter2/chapter2.md b/source/chapter2/chapter2.md old mode 100644 new mode 100755 diff --git a/source/chapter3/01_About_the_Language_Reference.md b/source/chapter3/01_About_the_Language_Reference.md old mode 100644 new mode 100755 diff --git a/source/chapter3/02_Lexical_Structure.md b/source/chapter3/02_Lexical_Structure.md old mode 100644 new mode 100755 diff --git a/source/chapter3/03_Types.md b/source/chapter3/03_Types.md old mode 100644 new mode 100755 diff --git a/source/chapter3/04_Expressions.md b/source/chapter3/04_Expressions.md old mode 100644 new mode 100755 index 53db2650..b23d79ea --- a/source/chapter3/04_Expressions.md +++ b/source/chapter3/04_Expressions.md @@ -607,17 +607,17 @@ someInstance.dynamicType.printClassName() > > *dynamic-type-expression* → *postfix-expression*­.­dynamicType­ -### 附属脚本表达式(Subscript Expression) +### 下标脚本表达式(Subscript Expression) -附属脚本表达式提供了通过附属脚本访问getter/setter 的方法。它的形式是: +下标脚本表达式提供了通过下标脚本访问getter/setter 的方法。它的形式是: `expression`[`index expressions`] -可以通过附属脚本表达式通过getter获取某个值,或者通过setter赋予某个值. +可以通过下标脚本表达式通过getter获取某个值,或者通过setter赋予某个值. 关于subscript的声明,请参见: Protocol Subscript Declaration. -> 附属脚本表达式的语法 +> 下标脚本表达式的语法 > > *subscript-expression* → *postfix-expression*­[­*expression-list*­]­ diff --git a/source/chapter3/05_Declarations.md b/source/chapter3/05_Declarations.md old mode 100644 new mode 100755 index e928c346..914a46da --- a/source/chapter3/05_Declarations.md +++ b/source/chapter3/05_Declarations.md @@ -21,7 +21,7 @@ - [构造器声明](#initializer_declaration) - [析构声明](#deinitializer_declaration) - [扩展声明](#extension_declaration) -- [附属脚本声明](#subscript_declaration) +- [下标脚本声明](#subscript_declaration) - [运算符声明](#operator_declaration) 一条声明可以在你的程序里引入新的名字和构造。举例来说,你可以使用声明来引入函数和方法,变量和常量,或者来定义 @@ -136,7 +136,7 @@ 3 println("The second number is \(secondNumber).") 4 // prints "The second number is 42." -类型注释(:type)在常量声明中是一个可选项,它可以用来描述在类型接口(type inference)中找到的类型。 +类型注释(:type)在常量声明中是一个可选项,它可以用来描述在类型推断(type inference)中找到的类型。 声明一个静态常量要使用关键字static。静态属性在类型属性(type propetries)中有介绍。 @@ -616,7 +616,7 @@ protocol protocol name: inherited protocols { } ``` -协议的主体包含零或多个协议成员声明,这些成员描述了任何采用该协议必须满足的一致性要求。特别的,一个协议可以声明必须实现某些属性、方法、初始化程序及附属脚本的一致性类型。协议也可以声明专用种类的类型别名,叫做关联类型,它可以指定协议的不同声明之间的关系。协议成员声明会在下面的详情里进行讨论。 +协议的主体包含零或多个协议成员声明,这些成员描述了任何采用该协议必须满足的一致性要求。特别的,一个协议可以声明必须实现某些属性、方法、初始化程序及下标脚本的一致性类型。协议也可以声明专用种类的类型别名,叫做关联类型,它可以指定协议的不同声明之间的关系。协议成员声明会在下面的详情里进行讨论。 协议类型可以从很多其它协议那继承。当一个协议类型从其它协议那继承的时候,来自其它协议的所有要求就集合了,而且从当前协议继承的任何类型必须符合所有的这些要求。对于如何使用协议继承的例子,查看[协议继承](../chapter2/21_Protocols.html#protocol_inheritance) @@ -626,7 +626,7 @@ protocol protocol name: inherited protocols { 你可以通过采用在类型的扩展声明中的协议来为之前声明的类型添加协议一致性。在扩展中你必须实现所有采用协议的要求。如果该类型已经实现了所有的要求,你可以让这个扩展声明的主题留空。 -默认地,符合某一个协议的类型必须实现所有声明在协议中的属性、方法和附属脚本。也就是说,你可以用`optional`属性标注这些协议成员声明以指定它们的一致性类型实现是可选的。`optional`属性仅仅可以用于使用`objc`属性标记过的协议。这样的结果就是仅仅类类型可以采用并符合包含可选成员要求的协议。更多关于如何使用`optional`属性的信息及如何访问可选协议成员的指导——比如当你不能肯定是否一致性的类型实现了它们——参见[可选协议要求](../chapter2/21_Protocols.html#optional_protocol_requirements) +默认地,符合某一个协议的类型必须实现所有声明在协议中的属性、方法和下标脚本。也就是说,你可以用`optional`属性标注这些协议成员声明以指定它们的一致性类型实现是可选的。`optional`属性仅仅可以用于使用`objc`属性标记过的协议。这样的结果就是仅仅类类型可以采用并符合包含可选成员要求的协议。更多关于如何使用`optional`属性的信息及如何访问可选协议成员的指导——比如当你不能肯定是否一致性的类型实现了它们——参见[可选协议要求](../chapter2/21_Protocols.html#optional_protocol_requirements) 为了限制协议的采用仅仅针对类类型,需要使用`class_protocol`属性标记整个协议声明。任意继承自标记有`class_protocol`属性协议的协议都可以智能地仅能被类类型采用。 @@ -694,18 +694,18 @@ protocol-property-declaration → variable-declaration-head­variable-name­type >protocol-initializer-declaration → initializer-head­generic-parameter-clause­opt­parameter-clause­ -###协议附属脚本声明 +###协议下标脚本声明 -协议声明了一致性类型必须在协议声明的主体里通过引入一个协议附属脚本声明来实现一个附属脚本。协议属性声明 -对附属脚本声明有一个特殊的形式: +协议声明了一致性类型必须在协议声明的主体里通过引入一个协议下标脚本声明来实现一个下标脚本。协议属性声明 +对下标脚本声明有一个特殊的形式: >subscript (parameters) -> return type { get set } -附属脚本声明只为和协议一致的类型声明了必需的最小数量的的getter和setter。如果附属脚本申明包含get和set关键字, -一致的类型也必须有一个getter和setter语句。如果附属脚本声明值包含get关键字,一致的类型必须至少包含一个 +下标脚本声明只为和协议一致的类型声明了必需的最小数量的的getter和setter。如果下标脚本申明包含get和set关键字, +一致的类型也必须有一个getter和setter语句。如果下标脚本声明值包含get关键字,一致的类型必须至少包含一个 getter语句,可以选择是否包含setter语句。 -更多参阅附属脚本声明。 +更多参阅下标脚本声明。 >GRAMMAR OF A PROTOCOL SUBSCRIPT DECLARATION @@ -754,7 +754,7 @@ getter语句,可以选择是否包含setter语句。 你可以使用requierd关键字,将便利构造器和指定构造器标记为每个子类的构造器都必须拥有的。因为指定构造器 不被子类继承,他们必须被立即执行。当子类直接执行所有超类的指定构造器(或使用便利构造器重写指定构造器)时, -必需的便利构造器可以被隐式的执行,亦可以被继承。不像方法,附属脚本那样,你不需要为这些重写的构造器标注 +必需的便利构造器可以被隐式的执行,亦可以被继承。不像方法,下标脚本那样,你不需要为这些重写的构造器标注 overrride关键字。 查看更多关于不同声明方法的构造器的例子,参阅构造过程一节。 @@ -798,7 +798,7 @@ overrride关键字。 } 一个扩展声明体包括零个或多个声明。这些声明可以包括计算型属性,计算型静态属性,实例方法,静态和类方法,构造器, -附属脚本声明,甚至其他结构体,类,和枚举声明。扩展声明不能包含析构器,协议声明,存储型属性,属性监测器或其他 +下标脚本声明,甚至其他结构体,类,和枚举声明。扩展声明不能包含析构器,协议声明,存储型属性,属性监测器或其他 的扩展属性。详细讨论和查看包含多种扩展声明的实例,参见扩展一节。 扩展声明可以向现存的类,结构体,枚举内添加一致的协议。扩展声明不能向一个类中添加继承的类,因此 @@ -815,9 +815,9 @@ type-inheritance-clause是一个只包含协议列表的扩展声明。 >extension-body → {­declarations­opt­}­ -##附属脚本声明(translated by 林) +##下标脚本声明(translated by 林) -附属脚本用于向特定类型添加附属脚本支持,通常为访问集合,列表和序列的元素时提供语法便利。附属脚本声明使用关键字`subscript`,声明形式如下: +下标脚本用于向特定类型添加下标脚本支持,通常为访问集合,列表和序列的元素时提供语法便利。下标脚本声明使用关键字`subscript`,声明形式如下: > subscript (`parameter`) -> (return type){ get{ `statements` @@ -826,19 +826,19 @@ type-inheritance-clause是一个只包含协议列表的扩展声明。 `statements` } } -附属脚本声明只能在类,结构体,枚举,扩展和协议声明的上下文进行声明。 +下标脚本声明只能在类,结构体,枚举,扩展和协议声明的上下文进行声明。 -_变量(parameters)_指定一个或多个用于在相关类型的附属脚本中访问元素的索引(例如,表达式`object[i]`中的`i`)。尽管用于元素访问的索引可以是任意类型的,但是每个变量必须包含一个用于指定每种索引类型的类型标注。_返回类型(return type)_指定被访问的元素的类型。 +_变量(parameters)_指定一个或多个用于在相关类型的下标脚本中访问元素的索引(例如,表达式`object[i]`中的`i`)。尽管用于元素访问的索引可以是任意类型的,但是每个变量必须包含一个用于指定每种索引类型的类型标注。_返回类型(return type)_指定被访问的元素的类型。 -和计算性属性一样,附属脚本声明支持对访问元素的读写操作。getter用于读取值,setter用于写入值。setter子句是可选的,当仅需要一个getter子句时,可以将二者都忽略且直接返回请求的值即可。也就是说,如果使用了setter子句,就必须使用getter子句。 +和计算性属性一样,下标脚本声明支持对访问元素的读写操作。getter用于读取值,setter用于写入值。setter子句是可选的,当仅需要一个getter子句时,可以将二者都忽略且直接返回请求的值即可。也就是说,如果使用了setter子句,就必须使用getter子句。 setter的名字和封闭的括号是可选的。如果使用了setter名称,它会被当做传给setter的变量的名称。如果不使用setter名称,那么传给setter的变量的名称默认是`value`。setter名称的类型必须与_返回类型(return type)_的类型相同。 -可以在附属脚本声明的类型中,可以重载附属脚本,只要_变量(parameters)_或_返回类型(return type)_与先前的不同即可。此时,必须使用`override`关键字声明那个被覆盖的附属脚本。(注:好乱啊!到底是重载还是覆盖?!) +可以在下标脚本声明的类型中,可以重载下标脚本,只要_变量(parameters)_或_返回类型(return type)_与先前的不同即可。此时,必须使用`override`关键字声明那个被覆盖的下标脚本。(注:好乱啊!到底是重载还是覆盖?!) -同样可以在协议声明的上下文中声明附属脚本,[Protocol Subscript Declaration](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Declarations.html#//apple_ref/doc/uid/TP40014097-CH34-XID_619)中有所描述。 +同样可以在协议声明的上下文中声明下标脚本,[Protocol Subscript Declaration](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Declarations.html#//apple_ref/doc/uid/TP40014097-CH34-XID_619)中有所描述。 -更多关于附属脚本和附属脚本声明的例子,请参考[Subscripts](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Subscripts.html#//apple_ref/doc/uid/TP40014097-CH16-XID_393)。 +更多关于下标脚本和下标脚本声明的例子,请参考[Subscripts](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Subscripts.html#//apple_ref/doc/uid/TP40014097-CH16-XID_393)。 >GRAMMAR OF A SUBSCRIPT DECLARATION diff --git a/source/chapter3/06_Attributes.md b/source/chapter3/06_Attributes.md old mode 100644 new mode 100755 diff --git a/source/chapter3/07_Patterns.md b/source/chapter3/07_Patterns.md old mode 100644 new mode 100755 diff --git a/source/chapter3/08_Generic_Parameters_and_Arguments.md b/source/chapter3/08_Generic_Parameters_and_Arguments.md old mode 100644 new mode 100755 diff --git a/source/chapter3/09_Summary_of_the_Grammar.md b/source/chapter3/09_Summary_of_the_Grammar.md old mode 100644 new mode 100755 index 87d5c488..6d560a2c --- a/source/chapter3/09_Summary_of_the_Grammar.md +++ b/source/chapter3/09_Summary_of_the_Grammar.md @@ -159,7 +159,7 @@ _________________ > *声明* → [*构造器声明*](..\chapter3\05_Declarations.html#initializer_declaration) > *声明* → [*析构器声明*](..\chapter3\05_Declarations.html#deinitializer_declaration) > *声明* → [*扩展声明*](..\chapter3\05_Declarations.html#extension_declaration) -> *声明* → [*附属脚本声明*](..\chapter3\05_Declarations.html#subscript_declaration) +> *声明* → [*下标脚本声明*](..\chapter3\05_Declarations.html#subscript_declaration) > *声明* → [*运算符声明*](..\chapter3\05_Declarations.html#operator_declaration) > *声明(Declarations)列表* → [*声明*](..\chapter3\05_Declarations.html#declaration) [*声明(Declarations)列表*](..\chapter3\05_Declarations.html#declarations) _可选_ > *声明描述符(Specifiers)列表* → [*声明描述符(Specifier)*](..\chapter3\05_Declarations.html#declaration_specifier) [*声明描述符(Specifiers)列表*](..\chapter3\05_Declarations.html#declaration_specifiers) _可选_ @@ -285,7 +285,7 @@ _________________ > *协议成员声明* → [*协议属性声明*](..\chapter3\05_Declarations.html#protocol_property_declaration) > *协议成员声明* → [*协议方法声明*](..\chapter3\05_Declarations.html#protocol_method_declaration) > *协议成员声明* → [*协议构造器声明*](..\chapter3\05_Declarations.html#protocol_initializer_declaration) -> *协议成员声明* → [*协议附属脚本声明*](..\chapter3\05_Declarations.html#protocol_subscript_declaration) +> *协议成员声明* → [*协议下标脚本声明*](..\chapter3\05_Declarations.html#protocol_subscript_declaration) > *协议成员声明* → [*协议关联类型声明*](..\chapter3\05_Declarations.html#protocol_associated_type_declaration) > *协议成员声明(Declarations)列表* → [*协议成员声明*](..\chapter3\05_Declarations.html#protocol_member_declaration) [*协议成员声明(Declarations)列表*](..\chapter3\05_Declarations.html#protocol_member_declarations) _可选_ @@ -306,8 +306,8 @@ _________________

-> 协议附属脚本声明语法 -> *协议附属脚本声明* → [*附属脚本头(Head)*](..\chapter3\05_Declarations.html#subscript_head) [*附属脚本结果(Result)*](..\chapter3\05_Declarations.html#subscript_result) [*getter-setter关键字(Keyword)块*](..\chapter3\05_Declarations.html#getter_setter_keyword_block) +> 协议下标脚本声明语法 +> *协议下标脚本声明* → [*下标脚本头(Head)*](..\chapter3\05_Declarations.html#subscript_head) [*下标脚本结果(Result)*](..\chapter3\05_Declarations.html#subscript_result) [*getter-setter关键字(Keyword)块*](..\chapter3\05_Declarations.html#getter_setter_keyword_block)

@@ -334,12 +334,12 @@ _________________

-> 附属脚本声明语法 -> *附属脚本声明* → [*附属脚本头(Head)*](..\chapter3\05_Declarations.html#subscript_head) [*附属脚本结果(Result)*](..\chapter3\05_Declarations.html#subscript_result) [*代码块*](..\chapter3\05_Declarations.html#code_block) -> *附属脚本声明* → [*附属脚本头(Head)*](..\chapter3\05_Declarations.html#subscript_head) [*附属脚本结果(Result)*](..\chapter3\05_Declarations.html#subscript_result) [*getter-setter块*](..\chapter3\05_Declarations.html#getter_setter_block) -> *附属脚本声明* → [*附属脚本头(Head)*](..\chapter3\05_Declarations.html#subscript_head) [*附属脚本结果(Result)*](..\chapter3\05_Declarations.html#subscript_result) [*getter-setter关键字(Keyword)块*](..\chapter3\05_Declarations.html#getter_setter_keyword_block) -> *附属脚本头(Head)* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **subscript** [*参数子句*](..\chapter3\05_Declarations.html#parameter_clause) -> *附属脚本结果(Result)* → **->** [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ [*类型*](..\chapter3\03_Types.html#type) +> 下标脚本声明语法 +> *下标脚本声明* → [*下标脚本头(Head)*](..\chapter3\05_Declarations.html#subscript_head) [*下标脚本结果(Result)*](..\chapter3\05_Declarations.html#subscript_result) [*代码块*](..\chapter3\05_Declarations.html#code_block) +> *下标脚本声明* → [*下标脚本头(Head)*](..\chapter3\05_Declarations.html#subscript_head) [*下标脚本结果(Result)*](..\chapter3\05_Declarations.html#subscript_result) [*getter-setter块*](..\chapter3\05_Declarations.html#getter_setter_block) +> *下标脚本声明* → [*下标脚本头(Head)*](..\chapter3\05_Declarations.html#subscript_head) [*下标脚本结果(Result)*](..\chapter3\05_Declarations.html#subscript_result) [*getter-setter关键字(Keyword)块*](..\chapter3\05_Declarations.html#getter_setter_keyword_block) +> *下标脚本头(Head)* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **subscript** [*参数子句*](..\chapter3\05_Declarations.html#parameter_clause) +> *下标脚本结果(Result)* → **->** [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ [*类型*](..\chapter3\03_Types.html#type)

diff --git a/source/chapter3/10_Statements.md b/source/chapter3/10_Statements.md old mode 100644 new mode 100755 diff --git a/source/chapter3/chapter3.md b/source/chapter3/chapter3.md old mode 100644 new mode 100755