diff --git a/_zh-cn/overviews/scala3-book/ca-context-bounds.md b/_zh-cn/overviews/scala3-book/ca-context-bounds.md index 72b55ca94d..56d948bad0 100644 --- a/_zh-cn/overviews/scala3-book/ca-context-bounds.md +++ b/_zh-cn/overviews/scala3-book/ca-context-bounds.md @@ -2,8 +2,9 @@ title: 上下文绑定 type: section description: This page demonstrates Context Bounds in Scala 3. +language: zh-cn num: 61 -previous-page: types-type-classes +previous-page: ca-given-using-clauses next-page: ca-given-imports partof: scala3-book diff --git a/_zh-cn/overviews/scala3-book/ca-contextual-abstractions-intro.md b/_zh-cn/overviews/scala3-book/ca-contextual-abstractions-intro.md index 0cb7bd80c1..80136106d6 100644 --- a/_zh-cn/overviews/scala3-book/ca-contextual-abstractions-intro.md +++ b/_zh-cn/overviews/scala3-book/ca-contextual-abstractions-intro.md @@ -2,6 +2,7 @@ title: 上下文抽象 type: chapter description: This chapter provides an introduction to the Scala 3 concept of Contextual Abstractions. +language: zh-cn num: 58 previous-page: types-others next-page: ca-given-using-clauses diff --git a/_zh-cn/overviews/scala3-book/ca-extension-methods.md b/_zh-cn/overviews/scala3-book/ca-extension-methods.md index 8565811725..7d780cae1f 100644 --- a/_zh-cn/overviews/scala3-book/ca-extension-methods.md +++ b/_zh-cn/overviews/scala3-book/ca-extension-methods.md @@ -2,9 +2,10 @@ title: 扩展方法 type: section description: This page demonstrates how Extension Methods work in Scala 3. -num: 63 -previous-page: ca-given-imports -next-page: ca-type-classes +language: zh-cn +num: 59 +previous-page: ca-contextual-abstractions-intro +next-page: ca-given-using-clauses partof: scala3-book overview-name: "Scala 3 — Book" diff --git a/_zh-cn/overviews/scala3-book/ca-given-imports.md b/_zh-cn/overviews/scala3-book/ca-given-imports.md index 245cd1feec..faf1e8569d 100644 --- a/_zh-cn/overviews/scala3-book/ca-given-imports.md +++ b/_zh-cn/overviews/scala3-book/ca-given-imports.md @@ -2,9 +2,10 @@ title: Given 导入 type: section description: This page demonstrates how 'given' import statements work in Scala 3. +language: zh-cn num: 62 previous-page: ca-context-bounds -next-page: ca-extension-methods +next-page: ca-type-classes partof: scala3-book overview-name: "Scala 3 — Book" diff --git a/_zh-cn/overviews/scala3-book/ca-given-using-clauses.md b/_zh-cn/overviews/scala3-book/ca-given-using-clauses.md index f6c56c3897..c562e5d167 100644 --- a/_zh-cn/overviews/scala3-book/ca-given-using-clauses.md +++ b/_zh-cn/overviews/scala3-book/ca-given-using-clauses.md @@ -2,9 +2,10 @@ title: Given 实例和 Using 语句 type: section description: This page demonstrates how to use 'given' instances and 'using' clauses in Scala 3. -num: 59 -previous-page: ca-contextual-abstractions-intro -next-page: types-type-classes +language: zh-cn +num: 60 +previous-page: ca-extension-methods +next-page: ca-context-bounds partof: scala3-book overview-name: "Scala 3 — Book" diff --git a/_zh-cn/overviews/scala3-book/ca-implicit-conversions.md b/_zh-cn/overviews/scala3-book/ca-implicit-conversions.md index e79c252822..69a12cba3e 100644 --- a/_zh-cn/overviews/scala3-book/ca-implicit-conversions.md +++ b/_zh-cn/overviews/scala3-book/ca-implicit-conversions.md @@ -2,7 +2,8 @@ title: 隐式转换 type: section description: This page demonstrates how to implement Implicit Conversions in Scala 3. -num: 66 +language: zh-cn +num: 65 previous-page: ca-multiversal-equality next-page: ca-summary diff --git a/_zh-cn/overviews/scala3-book/ca-multiversal-equality.md b/_zh-cn/overviews/scala3-book/ca-multiversal-equality.md index 02170a260a..aff8f1d53e 100644 --- a/_zh-cn/overviews/scala3-book/ca-multiversal-equality.md +++ b/_zh-cn/overviews/scala3-book/ca-multiversal-equality.md @@ -2,7 +2,8 @@ title: 多元相等性 type: section description: This page demonstrates how to implement Multiversal Equality in Scala 3. -num: 65 +language: zh-cn +num: 64 previous-page: ca-type-classes next-page: ca-implicit-conversions diff --git a/_zh-cn/overviews/scala3-book/ca-summary.md b/_zh-cn/overviews/scala3-book/ca-summary.md index 04381a0ede..c492e8f993 100644 --- a/_zh-cn/overviews/scala3-book/ca-summary.md +++ b/_zh-cn/overviews/scala3-book/ca-summary.md @@ -2,7 +2,8 @@ title: 总结 type: section description: This page provides a summary of the Contextual Abstractions lessons. -num: 67 +language: zh-cn +num: 66 previous-page: ca-implicit-conversions next-page: concurrency diff --git a/_zh-cn/overviews/scala3-book/ca-type-classes.md b/_zh-cn/overviews/scala3-book/ca-type-classes.md index 5cef98e383..3543f68a34 100644 --- a/_zh-cn/overviews/scala3-book/ca-type-classes.md +++ b/_zh-cn/overviews/scala3-book/ca-type-classes.md @@ -2,8 +2,9 @@ title: 实现类型类 type: section description: This page demonstrates how to create and use type classes in Scala 3. -num: 64 -previous-page: ca-extension-methods +language: zh-cn +num: 63 +previous-page: ca-given-imports next-page: ca-multiversal-equality partof: scala3-book diff --git a/_zh-cn/overviews/scala3-book/collections-classes.md b/_zh-cn/overviews/scala3-book/collections-classes.md index 2b494d7791..307395fba9 100644 --- a/_zh-cn/overviews/scala3-book/collections-classes.md +++ b/_zh-cn/overviews/scala3-book/collections-classes.md @@ -2,6 +2,7 @@ title: 集合类型 type: section description: This page introduces the common Scala 3 collections types and some of their methods. +language: zh-cn num: 37 previous-page: collections-intro next-page: collections-methods @@ -371,7 +372,9 @@ val people = ArrayBuffer( ```scala val nums = ArrayBuffer(1, 2, 3) // ArrayBuffer(1, 2, 3) +language: zh-cn nums += 4 // ArrayBuffer(1, 2, 3, 4) +language: zh-cn nums ++= List(5, 6) // ArrayBuffer(1, 2, 3, 4, 5, 6) ``` diff --git a/_zh-cn/overviews/scala3-book/collections-intro.md b/_zh-cn/overviews/scala3-book/collections-intro.md index 2b8f83481e..6d21b2f59b 100644 --- a/_zh-cn/overviews/scala3-book/collections-intro.md +++ b/_zh-cn/overviews/scala3-book/collections-intro.md @@ -2,6 +2,7 @@ title: Scala 集合 type: chapter description: This page provides and introduction to the common collections classes and their methods in Scala 3. +language: zh-cn num: 36 previous-page: packaging-imports next-page: collections-classes diff --git a/_zh-cn/overviews/scala3-book/collections-methods.md b/_zh-cn/overviews/scala3-book/collections-methods.md index 518754ad37..93ca03d15a 100644 --- a/_zh-cn/overviews/scala3-book/collections-methods.md +++ b/_zh-cn/overviews/scala3-book/collections-methods.md @@ -2,6 +2,7 @@ title: 集合方法 type: section description: This page demonstrates the common methods on the Scala 3 collections classes. +language: zh-cn num: 38 previous-page: collections-classes next-page: collections-summary diff --git a/_zh-cn/overviews/scala3-book/collections-summary.md b/_zh-cn/overviews/scala3-book/collections-summary.md index 45456d2557..465f339f19 100644 --- a/_zh-cn/overviews/scala3-book/collections-summary.md +++ b/_zh-cn/overviews/scala3-book/collections-summary.md @@ -2,6 +2,7 @@ title: 总结 type: section description: This page provides a summary of the Collections chapter. +language: zh-cn num: 39 previous-page: collections-methods next-page: fp-intro diff --git a/_zh-cn/overviews/scala3-book/concurrency.md b/_zh-cn/overviews/scala3-book/concurrency.md index cd2b7e8fde..1906f158ab 100644 --- a/_zh-cn/overviews/scala3-book/concurrency.md +++ b/_zh-cn/overviews/scala3-book/concurrency.md @@ -2,7 +2,8 @@ title: 并发 type: chapter description: This page discusses how Scala concurrency works, with an emphasis on Scala Futures. -num: 68 +language: zh-cn +num: 67 previous-page: ca-summary next-page: scala-tools diff --git a/_zh-cn/overviews/scala3-book/control-structures.md b/_zh-cn/overviews/scala3-book/control-structures.md index d552145c19..a639686f9c 100644 --- a/_zh-cn/overviews/scala3-book/control-structures.md +++ b/_zh-cn/overviews/scala3-book/control-structures.md @@ -2,6 +2,7 @@ title: 控制结构 type: chapter description: This page provides an introduction to Scala's control structures, including if/then/else, 'for' loops, 'for' expressions, 'match' expressions, try/catch/finally, and 'while' loops. +language: zh-cn num: 18 previous-page: first-look-at-types next-page: domain-modeling-intro diff --git a/_zh-cn/overviews/scala3-book/domain-modeling-fp.md b/_zh-cn/overviews/scala3-book/domain-modeling-fp.md index c218cb5439..e9f6933cad 100644 --- a/_zh-cn/overviews/scala3-book/domain-modeling-fp.md +++ b/_zh-cn/overviews/scala3-book/domain-modeling-fp.md @@ -2,6 +2,7 @@ title: 函数式领域建模 type: section description: This chapter provides an introduction to FP domain modeling with Scala 3. +language: zh-cn num: 22 previous-page: domain-modeling-oop next-page: methods-intro diff --git a/_zh-cn/overviews/scala3-book/domain-modeling-intro.md b/_zh-cn/overviews/scala3-book/domain-modeling-intro.md index f2924f69a7..db31d9c528 100644 --- a/_zh-cn/overviews/scala3-book/domain-modeling-intro.md +++ b/_zh-cn/overviews/scala3-book/domain-modeling-intro.md @@ -2,6 +2,7 @@ title: 领域建模 type: chapter description: This chapter provides an introduction to domain modeling in Scala 3. +language: zh-cn num: 19 previous-page: control-structures next-page: domain-modeling-tools diff --git a/_zh-cn/overviews/scala3-book/domain-modeling-oop.md b/_zh-cn/overviews/scala3-book/domain-modeling-oop.md index 47a238c169..a04c1fba41 100644 --- a/_zh-cn/overviews/scala3-book/domain-modeling-oop.md +++ b/_zh-cn/overviews/scala3-book/domain-modeling-oop.md @@ -2,6 +2,7 @@ title: OOP 领域建模 type: section description: This chapter provides an introduction to OOP domain modeling with Scala 3. +language: zh-cn num: 21 previous-page: domain-modeling-tools next-page: domain-modeling-fp diff --git a/_zh-cn/overviews/scala3-book/domain-modeling-tools.md b/_zh-cn/overviews/scala3-book/domain-modeling-tools.md index 1cfcaab10d..eb37e8e7f4 100644 --- a/_zh-cn/overviews/scala3-book/domain-modeling-tools.md +++ b/_zh-cn/overviews/scala3-book/domain-modeling-tools.md @@ -2,6 +2,7 @@ title: 工具 type: section description: This chapter provides an introduction to the available domain modeling tools in Scala 3, including classes, traits, enums, and more. +language: zh-cn num: 20 previous-page: domain-modeling-intro next-page: domain-modeling-oop diff --git a/_zh-cn/overviews/scala3-book/first-look-at-types.md b/_zh-cn/overviews/scala3-book/first-look-at-types.md index 5cc496806c..03604b8180 100644 --- a/_zh-cn/overviews/scala3-book/first-look-at-types.md +++ b/_zh-cn/overviews/scala3-book/first-look-at-types.md @@ -2,6 +2,7 @@ title: 类型初探 type: chapter description: This page provides a brief introduction to Scala's built-in data types, including Int, Double, String, Long, Any, AnyRef, Nothing, and Null. +language: zh-cn num: 17 previous-page: taste-summary next-page: control-structures @@ -13,7 +14,6 @@ permalink: "/zh-cn/scala3/book/:title.html" --- - ## 所有值都有一个类型 在 Scala 中,所有值都有一个类型,包括数值和函数。 diff --git a/_zh-cn/overviews/scala3-book/fp-functional-error-handling.md b/_zh-cn/overviews/scala3-book/fp-functional-error-handling.md index d0c2dd8749..d16d0eb80c 100644 --- a/_zh-cn/overviews/scala3-book/fp-functional-error-handling.md +++ b/_zh-cn/overviews/scala3-book/fp-functional-error-handling.md @@ -2,6 +2,7 @@ title: 函数式错误处理 type: section description: This section provides an introduction to functional error handling in Scala 3. +language: zh-cn num: 45 previous-page: fp-functions-are-values next-page: fp-summary diff --git a/_zh-cn/overviews/scala3-book/fp-functions-are-values.md b/_zh-cn/overviews/scala3-book/fp-functions-are-values.md index e6ad2bcac3..472abcead3 100644 --- a/_zh-cn/overviews/scala3-book/fp-functions-are-values.md +++ b/_zh-cn/overviews/scala3-book/fp-functions-are-values.md @@ -2,6 +2,7 @@ title: 函数是值 type: section description: This section looks at the use of functions as values in functional programming. +language: zh-cn num: 44 previous-page: fp-pure-functions next-page: fp-functional-error-handling diff --git a/_zh-cn/overviews/scala3-book/fp-immutable-values.md b/_zh-cn/overviews/scala3-book/fp-immutable-values.md index 085161228f..eb39d3daec 100644 --- a/_zh-cn/overviews/scala3-book/fp-immutable-values.md +++ b/_zh-cn/overviews/scala3-book/fp-immutable-values.md @@ -2,6 +2,7 @@ title: 不可变值 type: section description: This section looks at the use of immutable values in functional programming. +language: zh-cn num: 42 previous-page: fp-what-is-fp next-page: fp-pure-functions diff --git a/_zh-cn/overviews/scala3-book/fp-intro.md b/_zh-cn/overviews/scala3-book/fp-intro.md index 5af0f94021..f0862626d2 100644 --- a/_zh-cn/overviews/scala3-book/fp-intro.md +++ b/_zh-cn/overviews/scala3-book/fp-intro.md @@ -2,6 +2,7 @@ title: 函数式编程 type: chapter description: This chapter provides an introduction to functional programming in Scala 3. +language: zh-cn num: 40 previous-page: collections-summary next-page: fp-what-is-fp diff --git a/_zh-cn/overviews/scala3-book/fp-pure-functions.md b/_zh-cn/overviews/scala3-book/fp-pure-functions.md index 6e53e0f705..ef4803036a 100644 --- a/_zh-cn/overviews/scala3-book/fp-pure-functions.md +++ b/_zh-cn/overviews/scala3-book/fp-pure-functions.md @@ -2,6 +2,7 @@ title: 纯函数 type: section description: This section looks at the use of pure functions in functional programming. +language: zh-cn num: 43 previous-page: fp-immutable-values next-page: fp-functions-are-values diff --git a/_zh-cn/overviews/scala3-book/fp-summary.md b/_zh-cn/overviews/scala3-book/fp-summary.md index 5eb64f228a..f9c4dfce8f 100644 --- a/_zh-cn/overviews/scala3-book/fp-summary.md +++ b/_zh-cn/overviews/scala3-book/fp-summary.md @@ -2,6 +2,7 @@ title: 总结 type: section description: This section summarizes the previous functional programming sections. +language: zh-cn num: 46 previous-page: fp-functional-error-handling next-page: types-introduction diff --git a/_zh-cn/overviews/scala3-book/fp-what-is-fp.md b/_zh-cn/overviews/scala3-book/fp-what-is-fp.md index c7f05298a1..6411b55c41 100644 --- a/_zh-cn/overviews/scala3-book/fp-what-is-fp.md +++ b/_zh-cn/overviews/scala3-book/fp-what-is-fp.md @@ -2,6 +2,7 @@ title: 什么是函数式编程? type: section description: This section provides an answer to the question, what is functional programming? +language: zh-cn num: 41 previous-page: fp-intro next-page: fp-immutable-values diff --git a/_zh-cn/overviews/scala3-book/fun-anonymous-functions.md b/_zh-cn/overviews/scala3-book/fun-anonymous-functions.md index 25de7d14c7..f86a953bae 100644 --- a/_zh-cn/overviews/scala3-book/fun-anonymous-functions.md +++ b/_zh-cn/overviews/scala3-book/fun-anonymous-functions.md @@ -2,6 +2,7 @@ title: 匿名函数 type: section description: This page shows how to use anonymous functions in Scala, including examples with the List class 'map' and 'filter' functions. +language: zh-cn num: 28 previous-page: fun-intro next-page: fun-function-variables diff --git a/_zh-cn/overviews/scala3-book/fun-eta-expansion.md b/_zh-cn/overviews/scala3-book/fun-eta-expansion.md index bca25ec8fd..1c9ec31128 100644 --- a/_zh-cn/overviews/scala3-book/fun-eta-expansion.md +++ b/_zh-cn/overviews/scala3-book/fun-eta-expansion.md @@ -2,6 +2,7 @@ title: Eta 扩展 type: section description: This page discusses Eta Expansion, the Scala technology that automatically and transparently converts methods into functions. +language: zh-cn num: 30 previous-page: fun-function-variables next-page: fun-hofs diff --git a/_zh-cn/overviews/scala3-book/fun-function-variables.md b/_zh-cn/overviews/scala3-book/fun-function-variables.md index 75d164d0e9..3113b83a37 100644 --- a/_zh-cn/overviews/scala3-book/fun-function-variables.md +++ b/_zh-cn/overviews/scala3-book/fun-function-variables.md @@ -2,6 +2,7 @@ title: 函数变量 type: section description: This page shows how to use anonymous functions in Scala, including examples with the List class 'map' and 'filter' functions. +language: zh-cn num: 29 previous-page: fun-anonymous-functions next-page: fun-eta-expansion diff --git a/_zh-cn/overviews/scala3-book/fun-hofs.md b/_zh-cn/overviews/scala3-book/fun-hofs.md index b20c6212da..3b5128e73f 100644 --- a/_zh-cn/overviews/scala3-book/fun-hofs.md +++ b/_zh-cn/overviews/scala3-book/fun-hofs.md @@ -2,6 +2,7 @@ title: 高阶函数 type: section description: This page demonstrates how to create and use higher-order functions in Scala. +language: zh-cn num: 31 previous-page: fun-eta-expansion next-page: fun-write-map-function diff --git a/_zh-cn/overviews/scala3-book/fun-intro.md b/_zh-cn/overviews/scala3-book/fun-intro.md index 4a84ebf631..4bc7aceab3 100644 --- a/_zh-cn/overviews/scala3-book/fun-intro.md +++ b/_zh-cn/overviews/scala3-book/fun-intro.md @@ -2,6 +2,7 @@ title: 函数 type: chapter description: This chapter looks at all topics related to functions in Scala 3. +language: zh-cn num: 27 previous-page: methods-summary next-page: fun-anonymous-functions diff --git a/_zh-cn/overviews/scala3-book/fun-summary.md b/_zh-cn/overviews/scala3-book/fun-summary.md index f05694ee42..f5bcecaaa2 100644 --- a/_zh-cn/overviews/scala3-book/fun-summary.md +++ b/_zh-cn/overviews/scala3-book/fun-summary.md @@ -2,6 +2,7 @@ title: 总结 type: section description: This page shows how to use anonymous functions in Scala, including examples with the List class 'map' and 'filter' functions. +language: zh-cn num: 34 previous-page: fun-write-method-returns-function next-page: packaging-imports diff --git a/_zh-cn/overviews/scala3-book/fun-write-map-function.md b/_zh-cn/overviews/scala3-book/fun-write-map-function.md index 8240830912..0a48d583ec 100644 --- a/_zh-cn/overviews/scala3-book/fun-write-map-function.md +++ b/_zh-cn/overviews/scala3-book/fun-write-map-function.md @@ -2,6 +2,7 @@ title: 自定义 map 函数 type: section description: This page demonstrates how to create and use higher-order functions in Scala. +language: zh-cn num: 32 previous-page: fun-hofs next-page: fun-write-method-returns-function diff --git a/_zh-cn/overviews/scala3-book/fun-write-method-returns-function.md b/_zh-cn/overviews/scala3-book/fun-write-method-returns-function.md index 5e223041d5..0272c5242e 100644 --- a/_zh-cn/overviews/scala3-book/fun-write-method-returns-function.md +++ b/_zh-cn/overviews/scala3-book/fun-write-method-returns-function.md @@ -2,6 +2,7 @@ title: 创建可以返回函数的方法 type: section description: This page demonstrates how to create and use higher-order functions in Scala. +language: zh-cn num: 33 previous-page: fun-write-map-function next-page: fun-summary diff --git a/_zh-cn/overviews/scala3-book/interacting-with-java.md b/_zh-cn/overviews/scala3-book/interacting-with-java.md index dae978ba6e..12682a9303 100644 --- a/_zh-cn/overviews/scala3-book/interacting-with-java.md +++ b/_zh-cn/overviews/scala3-book/interacting-with-java.md @@ -2,7 +2,8 @@ title: 与 Java 交互 type: chapter description: This page demonstrates how Scala code can interact with Java, and how Java code can interact with Scala code. -num: 72 +language: zh-cn +num: 71 previous-page: tools-worksheets next-page: scala-for-java-devs diff --git a/_zh-cn/overviews/scala3-book/introduction.md b/_zh-cn/overviews/scala3-book/introduction.md index 003e2e3987..2e82050a0e 100644 --- a/_zh-cn/overviews/scala3-book/introduction.md +++ b/_zh-cn/overviews/scala3-book/introduction.md @@ -2,6 +2,7 @@ title: 导言 type: chapter description: This page begins the overview documentation of the Scala 3 language. +language: zh-cn num: 1 previous-page: next-page: scala-features diff --git a/_zh-cn/overviews/scala3-book/methods-intro.md b/_zh-cn/overviews/scala3-book/methods-intro.md index f6d66d0686..4c72c7e549 100644 --- a/_zh-cn/overviews/scala3-book/methods-intro.md +++ b/_zh-cn/overviews/scala3-book/methods-intro.md @@ -2,6 +2,7 @@ title: 方法 type: chapter description: This section introduces methods in Scala 3. +language: zh-cn num: 23 previous-page: domain-modeling-fp next-page: methods-most diff --git a/_zh-cn/overviews/scala3-book/methods-main-methods.md b/_zh-cn/overviews/scala3-book/methods-main-methods.md index fda3199aca..82d711b231 100644 --- a/_zh-cn/overviews/scala3-book/methods-main-methods.md +++ b/_zh-cn/overviews/scala3-book/methods-main-methods.md @@ -2,6 +2,7 @@ title: main 方法 type: section description: This page describes how 'main' methods and the '@main' annotation work in Scala 3. +language: zh-cn num: 25 previous-page: methods-most next-page: methods-summary @@ -13,7 +14,6 @@ permalink: "/zh-cn/scala3/book/:title.html" --- - Scala 3 提供了一种定义可以从命令行调用的程序的新方法:在方法中添加 `@main` 注释会将其变成可执行程序的入口点: ```scala diff --git a/_zh-cn/overviews/scala3-book/methods-most.md b/_zh-cn/overviews/scala3-book/methods-most.md index d9ad8e194d..b1aa18a6fc 100644 --- a/_zh-cn/overviews/scala3-book/methods-most.md +++ b/_zh-cn/overviews/scala3-book/methods-most.md @@ -2,6 +2,7 @@ title: 方法特性 type: section description: This section introduces Scala 3 methods, including main methods, extension methods, and more. +language: zh-cn num: 24 previous-page: methods-intro next-page: methods-main-methods diff --git a/_zh-cn/overviews/scala3-book/methods-summary.md b/_zh-cn/overviews/scala3-book/methods-summary.md index c74f976cd2..d406f100c0 100644 --- a/_zh-cn/overviews/scala3-book/methods-summary.md +++ b/_zh-cn/overviews/scala3-book/methods-summary.md @@ -2,6 +2,7 @@ title: 总结 type: section description: This section summarizes the previous sections on Scala 3 methods. +language: zh-cn num: 26 previous-page: methods-main-methods next-page: fun-intro diff --git a/_zh-cn/overviews/scala3-book/packaging-imports.md b/_zh-cn/overviews/scala3-book/packaging-imports.md index c87cc51b3d..b121f8b99c 100644 --- a/_zh-cn/overviews/scala3-book/packaging-imports.md +++ b/_zh-cn/overviews/scala3-book/packaging-imports.md @@ -2,6 +2,7 @@ title: 打包和导入 type: chapter description: A discussion of using packages and imports to organize your code, build related modules of code, control scope, and help prevent namespace collisions. +language: zh-cn num: 35 previous-page: fun-summary next-page: collections-intro diff --git a/_zh-cn/overviews/scala3-book/scala-features.md b/_zh-cn/overviews/scala3-book/scala-features.md index 6d9362cf6b..3674c522e5 100644 --- a/_zh-cn/overviews/scala3-book/scala-features.md +++ b/_zh-cn/overviews/scala3-book/scala-features.md @@ -2,6 +2,7 @@ title: Scala 3 特性 type: chapter description: This page discusses the main features of the Scala 3 programming language. +language: zh-cn num: 2 previous-page: introduction next-page: why-scala-3 @@ -13,24 +14,10 @@ permalink: "/zh-cn/scala3/book/:title.html" --- -{% comment %} -The name _Scala_ comes from the word _scalable_, and true to that name, the Scala language is used to power busy websites and analyze huge data sets. -This section introduces the features that make Scala a scalable language. -These features are split into three sections: -{% endcomment %} - _Scala_ 这个名字来源于 _scalable_ 一词。正如其名,Scala 语言被用于支撑高流量网站以及分析庞大的数据集。 本节介绍了使 Scala 成为一门可扩展语言的特性。 这些特性分为三个部分: -{% comment %} - -- High-level language features -- Lower-level language features -- Scala ecosystem features - -{% endcomment %} - - 高级语言特性 - 底层语言特性 - Scala 生态系统特性 @@ -39,36 +26,10 @@ _Scala_ 这个名字来源于 _scalable_ 一词。正如其名,Scala 语言被 I think of this section as being like an “elevator pitch.” {% endcomment %} -{% comment %} - -## High-level features - -{% endcomment %} - ## 高级特性 -{% comment %} -Looking at Scala from the proverbial “30,000 foot view,” you can make the following statements about it: -{% endcomment %} - 从宏观视角来看 Scala,您可以对它做出以下陈述: -{% comment %} - -- It’s a high-level programming language -- It has a concise, readable syntax -- It’s statically-typed (but feels dynamic) -- It has an expressive type system -- It’s a functional programming (FP) language -- It’s an object-oriented programming (OOP) language -- It supports the fusion of FP and OOP -- Contextual abstractions provide a clear way to implement _term inference_ -- It runs on the JVM (and in the browser) -- It interacts seamlessly with Java code -- It’s used for server-side applications (including microservices), big data applications, and can also be used in the browser with Scala.js - -{% endcomment %} - - 它是一种高级编程语言 - 它具有简明易读的语法 - 它是静态类型的(但使人感觉是动态的) @@ -81,34 +42,13 @@ Looking at Scala from the proverbial “30,000 foot view,” you can make the fo - 它与 Java 代码无缝交互 - 它可被用于服务器端应用(包括微服务)、大数据应用,也可以在浏览器中与 Scala.js 共同使用 -{% comment %} -The following sections take a quick look at these features. -{% endcomment %} - 以下部分将对这些特性进行简要介绍。 -{% comment %} - -### A high-level language - -{% endcomment %} - ### 一门高级语言 -{% comment %} -Scala is considered a high-level language in at least two ways. -First, like Java and many other modern languages, you don’t deal with low-level concepts like pointers and memory management. -{% endcomment %} - Scala 至少在两个方面被认为是一门高级语言。 首先,像 Java 和许多其他现代语言一样,您不需要与指针和内存管理等底层概念打交道。 -{% comment %} -Second, with the use of lambdas and higher-order functions, you write your code at a very high level. -As the functional programming saying goes, in Scala you write _what_ you want, not _how_ to achieve it. -That is, we don’t write imperative code like this: -{% endcomment %} - 其次,通过使用 lambda 与高阶函数,您可以在非常高的层次上编写代码。 正如函数式编程的说法,在 Scala 中,您编写您想要 _“什么”_,而不是 _“如何”_ 去实现它。 也就是说,我们不会像这样编写命令式代码: @@ -146,11 +86,6 @@ val newNumbers = double(oldNumbers) {% endtab %} {% endtabs %} -{% comment %} -That code instructs the compiler what to do on a step-by-step basis. -Instead, we write high-level, functional code using higher-order functions and lambdas like this to compute the same result: -{% endcomment %} - 这段代码指示编译器逐步执行特定操作。 相反,我们使用像这样的高阶函数与 lambda 来编写高层次的函数式代码以计算出相同的结果: @@ -162,25 +97,10 @@ val newNumbers = oldNumbers.map(_ * 2) {% endtab %} {% endtabs %} -{% comment %} -As you can see, that code is much more concise, easier to read, and easier to maintain. -{% endcomment %} - 如您所见,该代码更简洁、更容易阅读且更易于维护。 -{% comment %} - -### Concise syntax - -{% endcomment %} - ### 简明的语法 -{% comment %} -Scala has a concise, readable syntax. -For instance, variables are created concisely, and their types are clear: -{% endcomment %} - Scala 具有简明易读的语法。例如,变量的创建十分简洁,其类型也很明确。 {% tabs scala-features-3 %} @@ -192,11 +112,6 @@ val p = Person("Martin", "Odersky") {% endtab %} {% endtabs %} - -{% comment %} -Higher-order functions and lambdas make for concise code that’s readable: -{% endcomment %} - 高阶函数与 lambda 使代码简明易读: {% tabs scala-features-4 %} @@ -211,10 +126,6 @@ nums.filter(_ > 1) {% endtab %} {% endtabs %} -{% comment %} -Traits, classes, and methods are defined with a clean, light syntax: -{% endcomment %} - 特质(Traits)、类(Class)和方法(Method)都是用简洁、轻巧的语法定义的。 {% tabs scala-features-5 class=tabs-scala-version %} @@ -249,26 +160,10 @@ class Dog extends Animal, HasTail: {% endtab %} {% endtabs %} - -{% comment %} -Studies have shown that the time a developer spends _reading_ code to _writing_ code is at least a 10:1 ratio, so writing code that is concise _and_ readable is important. -{% endcomment %} - 研究表明,开发人员花在 _阅读_ 代码和 _编写_ 代码上的时间比例至少为 10:1。因此,编写简洁 _并_ 易读的代码非常重要。 -{% comment %} - -### A dynamic feel - -{% endcomment %} - ### 动态感受 -{% comment %} -Scala is a statically-typed language, but thanks to its type inference capabilities it feels dynamic. -All of these expressions look like a dynamically-typed language like Python or Ruby, but they’re all Scala: -{% endcomment %} - Scala 是一种静态类型的语言,但由于其类型推断能力,它使人感觉是动态的。所有这些表达式看起来都像 Python 或 Ruby 这样的动态类型语言代码,但其实它们都是 Scala 代码: {% tabs scala-features-6 class=tabs-scala-version %} @@ -298,26 +193,8 @@ val z = nums {% endtab %} {% endtabs %} -{% comment %} -As Heather Miller states, Scala is considered to be a [strong, statically-typed language](https://heather.miller.am/blog/types-in-scala.html), and you get all the benefits of static types: -{% endcomment %} - 正如 Heather Miller 所说,Scala 被认为是一种[强静态类型语言](https://heather.miller.am/blog/types-in-scala.html)。您可以获得静态类型的全部益处: -{% comment %} - -- Correctness: you catch most errors at compile-time -- Great IDE support - - Reliable code completion - - Catching errors at compile-time means catching mistakes as you type - - Easy and reliable refactoring -- You can refactor your code with confidence -- Method type declarations tell readers what the method does, and help serve as documentation -- Scalability and maintainability: types help ensure correctness across arbitrarily large applications and development teams -- Strong typing in combination with excellent inference enables mechanisms like [contextual abstraction]({{ site.scala3ref }}/contextual) that allows you to omit boilerplate code. Often, this boilerplate code can be inferred by the compiler, based on type definitions and a given context. - -{% endcomment %} - - 正确性:您可以在编译时捕获大多数错误 - 强大的 IDE 支持 - 可靠的代码补全 @@ -337,12 +214,6 @@ In that list: - Reliable code completion {% endcomment %} -{% comment %} - -### Expressive type system - -{% endcomment %} - ### 富有表现力的类型系统 {% comment %} @@ -355,36 +226,8 @@ In that list: * [Explicitly typed self references](/tour/self-types.html) {% endcomment %} -{% comment %} -Scala’s type system enforces, at compile-time, that abstractions are used in a safe and coherent manner. -In particular, the type system supports: -{% endcomment %} - Scala 的类型系统在编译时强制要求以安全与连贯的方式使用抽象概念。特别是,该类型系统支持: -{% comment %} -- [Inferred types]({% link _overviews/scala3-book/types-inferred.md %}) -- [Generic classes]({% link _overviews/scala3-book/types-generics.md %}) -- [Variance annotations]({% link _overviews/scala3-book/types-variance.md %}) -- [Upper](/tour/upper-type-bounds.html) and [lower](/tour/lower-type-bounds.html) type bounds -- [Polymorphic methods](/tour/polymorphic-methods.html) -- [Intersection types]({% link _overviews/scala3-book/types-intersection.md %}) -- [Union types]({% link _overviews/scala3-book/types-union.md %}) -- [Type lambdas]({{ site.scala3ref }}/new-types/type-lambdas.html) -- [`given` instances and `using` clauses]({% link _overviews/scala3-book/ca-given-using-clauses.md %}) -- [Extension methods]({% link _overviews/scala3-book/ca-extension-methods.md %}) -- [Type classes]({% link _overviews/scala3-book/ca-type-classes.md %}) -- [Multiversal equality]({% link _overviews/scala3-book/ca-multiversal-equality.md %}) -- [Opaque type aliases]({% link _overviews/scala3-book/types-opaque-types.md %}) -- [Open classes]({{ site.scala3ref }}/other-new-features/open-classes.html) -- [Match types]({{ site.scala3ref }}/new-types/match-types.html) -- [Dependent function types]({{ site.scala3ref }}/new-types/dependent-function-types.html) -- [Polymorphic function types]({{ site.scala3ref }}/new-types/polymorphic-function-types.html) -- [Context bounds]({{ site.scala3ref }}/contextual/context-bounds.html) -- [Context functions]({{ site.scala3ref }}/contextual/context-functions.html) -- [Inner classes](/tour/inner-classes.html) and [abstract type members](/tour/abstract-type-members.html) as object members -{% endcomment %} - - [推断类型]({% link _zh-cn/overviews/scala3-book/types-inferred.md %}) - [泛型类]({% link _zh-cn/overviews/scala3-book/types-generics.md %}) - [型变]({% link _zh-cn/overviews/scala3-book/types-variance.md %}) @@ -406,38 +249,12 @@ Scala 的类型系统在编译时强制要求以安全与连贯的方式使用 - [上下文函数]({{ site.scala3ref }}/contextual/context-functions.html) - 作为对象成员的[内部类](/tour/inner-classes.html) 与 [抽象类型](/tour/abstract-type-members.html) -{% comment %} -In combination, these features provide a powerful basis for the safe reuse of programming abstractions and for the type-safe extension of software. -{% endcomment %} - 通过结合使用,这些特性为编程抽象的安全重用及软件的类型安全扩展提供了强大的基础。 -{% comment %} - -### A functional programming language - -{% endcomment %} - ### 一门函数式编程语言 -{% comment %} -Scala is a functional programming (FP) language, meaning: -{% endcomment %} - Scala 是一门函数式编程(FP)语言,也就是说: -{% comment %} - -- Functions are values, and can be passed around like any other value -- Higher-order functions are directly supported -- Lambdas are built in -- Everything in Scala is an expression that returns a value -- Syntactically it’s easy to use immutable variables, and their use is encouraged -- It has a wealth of immutable collection classes in the standard library -- Those collection classes come with dozens of functional methods: they don’t mutate the collection, but instead return an updated copy of the data - -{% endcomment %} - - 函数是值,可以像任何其他值一样被传递 - 直接支持高阶函数 - 原生地支持 Lambda @@ -446,28 +263,11 @@ Scala 是一门函数式编程(FP)语言,也就是说: - 在标准库中有大量的不可变集合类 - 这些集合类带有许多函数式方法:它们不改变集合本身,而是返回数据的更新副本 -{% comment %} - -### An object-oriented language - -{% endcomment %} - ### 一门面向对象语言 -{% comment %} -Scala is an object-oriented programming (OOP) language. -Every value is an instance of a class and every “operator” is a method. -{% endcomment %} - Scala 是一门面向对象编程(OOP)语言。 每个值都是一个类的实例,每个“运算符”都是一个方法。 -{% comment %} -In Scala, all types inherit from a top-level class `Any`, whose immediate children are `AnyVal` (_value types_, such as `Int` and `Boolean`) and `AnyRef` (_reference types_, as in Java). -This means that the Java distinction between primitive types and boxed types (e.g. `int` vs. `Integer`) isn’t present in Scala. -Boxing and unboxing is completely transparent to the user. -{% endcomment %} - 在 Scala 中,所有类型都继承自顶层类 `Any`,其直接子类是 `AnyVal`(_值类型_,例如 `Int` 与 `Boolean`)和 `AnyRef`(_引用类型_,与 Java 中相同)。 这意味着 Scala 中不存在 Java 中原始类型和包装类型的区别(例如 `int` 与 `Integer`)。 装箱与拆箱对用户来说是完全透明的。 @@ -478,27 +278,12 @@ Boxing and unboxing is completely transparent to the user. - Add the “types hierarchy” image here? {% endcomment %} -{% comment %} - -### Supports FP/OOP fusion - -{% endcomment %} - ### 支持 FP 与 OOP 融合 {% comment %} NOTE: This text in the first line comes from this slide: https://twitter.com/alexelcu/status/996408359514525696 {% endcomment %} -{% comment %} -The essence of Scala is the fusion of functional programming and object-oriented programming in a typed setting: - -- Functions for the logic -- Objects for the modularity - -As [Martin Odersky has stated](https://jaxenter.com/current-state-scala-odersky-interview-129495.html), “Scala was designed to show that a fusion of functional and object-oriented programming is possible and practical.” -{% endcomment %} - Scala 的本质是函数式编程和面向对象编程的融合: - 函数用于代表逻辑 @@ -506,27 +291,8 @@ Scala 的本质是函数式编程和面向对象编程的融合: 正如 [Martin Odersky 所说](https://jaxenter.com/current-state-scala-odersky-interview-129495.html),“Scala 旨在表明函数式编程与面向对象编程的融合是切实可行的。” -{% comment %} - -### Term inference, made clearer - -{% endcomment %} - ### 表达式推断,更加清晰 -{% comment %} -Following Haskell, Scala was the second popular language to have some form of _implicits_. -In Scala 3 these concepts have been completely re-thought and more clearly implemented. - -The core idea is _term inference_: Given a type, the compiler synthesizes a “canonical” term that has that type. -In Scala, a context parameter directly leads to an inferred argument term that could also be written down explicitly. - -Use cases for this concept include implementing [type classes]({% link _overviews/scala3-book/ca-type-classes.md %}), establishing context, dependency injection, expressing capabilities, computing new types, and proving relationships between them. - -Scala 3 makes this process more clear than ever before. -Read about contextual abstractions in the [Reference documentation]({{ site.scala3ref }}/contextual). -{% endcomment %} - 继 Haskell 之后,Scala 是第二种具有某种形式的 _隐式_ 的流行语言。 在 Scala 3 中,这些概念经过了重新考虑并更清晰地实现。 @@ -538,26 +304,8 @@ Read about contextual abstractions in the [Reference documentation]({{ site.scal Scala 3 使此过程比以往任何时候都更加清晰。 请在[参考文档]({{ site.scala3ref }}/contextual)中阅读关于上下文抽象的内容。 -{% comment %} - -### Client & server - -{% endcomment %} - ### 客户端与服务器 -{% comment %} -Scala code runs on the Java Virtual Machine (JVM), so you get all of its benefits: - -- Security -- Performance -- Memory management -- Portability and platform independence -- The ability to use the wealth of existing Java and JVM libraries - -In addition to running on the JVM, Scala also runs in the browser with Scala.js (and open source third-party tools to integrate popular JavaScript libraries), and native executables can be built with Scala Native and GraalVM. -{% endcomment %} - Scala 代码在 Java 虚拟机(JVM)上运行,因此您可以获得它的全部益处: - 安全性 @@ -568,27 +316,11 @@ Scala 代码在 Java 虚拟机(JVM)上运行,因此您可以获得它的 除了在 JVM 上运行外,Scala 还可以通过 Scala.js (以及开源的第三方工具以集成流行的 JavaScript 库)在浏览器中运行,并且可以使用Scala Native 与 GraalVM 构建原生可执行文件。 -{% comment %} - -### Seamless Java interaction - -{% endcomment %} - ### 与 Java 无缝交互 -{% comment %} -You can use Java classes and libraries in your Scala applications, and you can use Scala code in your Java applications. -In regards to the second point, large libraries like [Akka](https://akka.io) and the [Play Framework](https://www.playframework.com) are written in Scala, and can be used in Java applications. -{% endcomment %} - 您可以在 Scala 应用程序中使用 Java 类和库,也可以在 Java 应用程序中使用 Scala 代码。 对于第二点来说,诸如 [Akka](https://akka.io) 和 [Play Framework](https://www.playframework.com) 之类的大型库是用 Scala 编写的,并且它们可以在 Java 应用程序中使用。 -{% comment %} -In regards to the first point, Java classes and libraries are used in Scala applications every day. -For instance, in Scala you can read files with a Java `BufferedReader` and `FileReader`: -{% endcomment %} - 对于第一点来说,Scala 应用程序中每天都会用到 Java 类和库。 例如,在 Scala 中,您可以使用 Java 的 `BufferedReader` 和 `FileReader` 来读取文件: @@ -602,12 +334,6 @@ val br = BufferedReader(FileReader(filename)) {% endtab %} {% endtabs %} -{% comment %} -Using Java code in Scala is generally seamless. - -Java collections can also be used in Scala, and if you want to use Scala’s rich collection class methods with them, you can convert them with just a few lines of code: -{% endcomment %} - 在 Scala 中使用 Java 代码通常是无缝衔接的。 Java 集合也可以在 Scala 中使用, 如果您想将 Scala 丰富的集合类方法与其一起使用,只需几行代码即可转换它们: @@ -621,26 +347,8 @@ val scalaList: Seq[Integer] = JavaClass.getJavaList().asScala.toSeq {% endtab %} {% endtabs %} -{% comment %} - -### Wealth of libraries - -{% endcomment %} - ### 丰富的库 -{% comment %} -As you’ll see in the third section of this page, Scala libraries and frameworks like these have been written to power busy websites and work with huge datasets: - -1. The [Play Framework](https://www.playframework.com) is a lightweight, stateless, developer-friendly, web-friendly architecture for creating highly-scalable applications -2. [Lagom](https://www.lagomframework.com) is a microservices framework that helps you decompose your legacy monolith and build, test, and deploy entire systems of reactive microservices -3. [Apache Spark](https://spark.apache.org) is a unified analytics engine for big data processing, with built-in modules for streaming, SQL, machine learning and graph processing - -The [Awesome Scala list](https://github.com/lauris/awesome-scala) shows dozens of additional open source tools that developers have created to build Scala applications. - -In addition to server-side programming, [Scala.js](https://www.scala-js.org) is a strongly-typed replacement for writing JavaScript, with open source third-party libraries that include tools to integrate with Facebook’s React library, jQuery, and more. -{% endcomment %} - 正如您将在本页的第三部分中所看到的那样,已经有诸如此类的 Scala 库和框架被编写出来用于支撑高流量网站以及分析庞大的数据集: 1. [Play Framework](https://www.playframework.com) 是一种用于创建高度可扩展应用程序的轻量级、无状态、对开发者及Web友好的架构 @@ -656,50 +364,11 @@ The Lower-Level Features section is like the second part of an elevator pitch. Assuming you told someone about the previous high-level features and then they say, “Tell me more,” this is what you might tell them. {% endcomment %} -{% comment %} - -## Lower-level language features - -{% endcomment %} - ## 底层语言特性 -{% comment %} -Where the previous section covered high-level features of Scala 3, it’s interesting to note that at a high level you can make the same statements about both Scala 2 and Scala 3. -A decade ago Scala started with a strong foundation of desirable features, and as you’ll see in this section, those benefits have been improved with Scala 3. -{% endcomment %} - 上一节介绍了 Scala 3 的高级特性,有趣的是,您可以从高层次上对 Scala 2 和 Scala 3 作出相同的表述。 十年前,Scala 就为各种理想特性打下了坚实基础,正如您在本节中即将看到的那样,这些效益在 Scala 3 中得到了提高。 -{% comment %} -At a “sea level” view of the details---i.e., the language features programmers use everyday---Scala 3 has significant advantages over Scala 2: - -- The ability to create algebraic data types (ADTs) more concisely with enums -- An even more concise and readable syntax: - - The “quiet” control structure syntax is easier to read - - Optional braces - - Fewer symbols in the code creates less visual noise, making it easier to read - - The `new` keyword is generally no longer needed when creating class instances - - The formality of package objects have been dropped in favor of simpler “top level” definitions -- A grammar that’s more clear: - - Multiple different uses of the `implicit` keyword have been removed; those uses are replaced by more obvious keywords like `given`, `using`, and `extension`, focusing on intent over mechanism (see the [Givens][givens] section for details) - - [Extension methods][extension] replace implicit classes with a clearer and simpler mechanism - - The addition of the `open` modifier for classes makes the developer intentionally declare that a class is open for modification, thereby limiting ad-hoc extensions to a code base - - [Multiversal equality][multiversal] rules out nonsensical comparisons with `==` and `!=` (i.e., attempting to compare a `Person` to a `Planet`) - - Macros are implemented much more easily - - Union and intersection offer a flexible way to model types - - Trait parameters replace and simplify early initializers - - [Opaque type aliases][opaque_types] replace most uses of value classes, while guaranteeing the absence of boxing - - Export clauses provide a simple and general way to express aggregation, which can replace the previous facade pattern of package objects inheriting from classes - - The procedure syntax has been dropped, and the varargs syntax has been changed, both to make the language more consistent - - The `@infix` annotation makes it obvious how you want a method to be applied - - The [`@targetName`]({{ site.scala3ref }}/other-new-features/targetName.html) method annotation defines an alternate name for the method, improving Java interoperability, and letting you provide aliases for symbolic operators - -It would take too much space to demonstrate all of those features here, but follow the links in the items above to see those features in action. -All of these features are discussed in detail in the *New*, *Changed*, and *Dropped* features pages in the [Overview documentation][reference]. -{% endcomment %} - 以小见大,从程序员日常使用的语言特性来看,Scala 3 比 Scala 2 具有显著优势: - 可以用枚举更简洁地创建代数数据类型(ADT) @@ -789,52 +458,14 @@ DROPPED FEATURES and will be phased out {% endcomment %} - -{% comment %} - -## Scala ecosystem - -{% endcomment %} - ## Scala 生态系统 -{% comment %} -TODO: I didn’t put much work into this section because I don’t know if you want - to add many tools because (a) that can be seen as an endorsement and - (b) it creates a section that can need more maintenance than average - since tool popularity can wax and wane. One way to avoid the first - point is to base the lists on Github stars and activity. -{% endcomment %} - -{% comment %} -Scala has a vibrant ecosystem, with libraries and frameworks for every need. -The [“Awesome Scala” list](https://github.com/lauris/awesome-scala) provides a list of hundreds of open source projects that are available to Scala developers, and the [Scaladex](https://index.scala-lang.org) provides a searchable index of Scala libraries. -Some of the more notable libraries are listed below. -{% endcomment %} - Scala 拥有一个充满活力的生态系统,有满足各种需求的库和框架。 [Awesome Scala 列表](https://github.com/lauris/awesome-scala)提供了数百个可供 Scala 开发者使用的开源项目,[Scaladex](https://index.scala-lang.org) 则提供了 Scala 库的可搜索索引。 以下列出了一些比较著名的库: -{% comment %} - -### Web development - -{% endcomment %} - ### Web 开发 -{% comment %} - -- The [Play Framework](https://www.playframework.com) followed the Ruby on Rails model to become a lightweight, stateless, developer-friendly, web-friendly architecture for highly-scalable applications -- [Scalatra](https://scalatra.org) is a tiny, high-performance, async web framework, inspired by Sinatra -- [Finatra](https://twitter.github.io/finatra) is Scala services built on TwitterServer and Finagle -- [Scala.js](https://www.scala-js.org) is a strongly-typed replacement for JavaScript that provides a safer way to build robust front-end web applications -- [ScalaJs-React](https://github.com/japgolly/scalajs-react) lifts Facebook’s React library into Scala.js, and endeavours to make it as type-safe and Scala-friendly as possible -- [Lagom](https://www.lagomframework.com) is a microservices framework that helps you decompose your legacy monolith and build, test, and deploy entire systems of Reactive microservices -- -{% endcomment %} - - [Play Framework](https://www.playframework.com) 遵循 Ruby on Rails 模型,是一种用于高度可扩展应用程序的轻量级、无状态、对开发者及Web友好的架构 - [Scalatra](https://scalatra.org) 是一个小型的、高性能的、异步的网络框架,其灵感来自于 Sinatra - [Finatra](https://twitter.github.io/finatra) 是基于 TwitterServer 和 Finagle 构建的 Scala 服务 @@ -842,10 +473,6 @@ Scala 拥有一个充满活力的生态系统,有满足各种需求的库和 - [ScalaJs-React](https://github.com/japgolly/scalajs-react) 将 Facebook 的 React 库整合至 Scala.js,并努力使其尽可能类型安全和 Scala 友好 - [Lagom](https://www.lagomframework.com) 是一种微服务框架,可帮助您分解遗留的单体应用并构建、测试和部署整个响应式微服务系统 -{% comment %} -HTTP(S) libraries: -{% endcomment %} - HTTP(S) 库: - [Akka-http](https://akka.io) @@ -853,10 +480,6 @@ HTTP(S) 库: - [Http4s](https://github.com/http4s/http4s) - [Sttp](https://github.com/softwaremill/sttp) -{% comment %} -JSON libraries: -{% endcomment %} - JSON 库: - [Argonaut](https://github.com/argonaut-io/argonaut) @@ -864,97 +487,44 @@ JSON 库: - [Json4s](https://github.com/json4s/json4s) - [Play-JSON](https://github.com/playframework/play-json) -{% comment %} -Serialization: -{% endcomment %} - 序列化: - [ScalaPB](https://github.com/scalapb/ScalaPB) -{% comment %} - -### Science and data analysis: - -{% endcomment %} - ### 科学和数据分析 - [Algebird](https://github.com/twitter/algebird) - [Spire](https://github.com/typelevel/spire) - [Squants](https://github.com/typelevel/squants) -{% comment %} - -### Big data - -{% endcomment %} - ### 大数据 - [Apache Spark](https://github.com/apache/spark) - [Apache Flink](https://github.com/apache/flink) -{% comment %} - -### AI, machine learning - -- [BigDL](https://github.com/intel-analytics/BigDL) (Distributed Deep Learning Framework for Apache Spark) for Apache Spark -- [TensorFlow Scala](https://github.com/eaplatanios/tensorflow_scala) - -{% endcomment %} - ### 人工智能,机器学习 - [BigDL](https://github.com/intel-analytics/BigDL) (用于 Apache Spark 的分布式深度学习框架) - [TensorFlow Scala](https://github.com/eaplatanios/tensorflow_scala) -{% comment %} - -### Functional Programming & Functional Reactive Programming - -{% endcomment %} - ### 函数式编程 & 函数式响应式编程 -{% comment %} -FP: -{% endcomment %} - 函数式编程: - [Cats](https://github.com/typelevel/cats) - [Zio](https://github.com/zio/zio) -{% comment %} -Functional reactive programming (FRP): -{% endcomment %} - 函数式响应式编程(FRP) - [fs2](https://github.com/typelevel/fs2) - [monix](https://github.com/monix/monix) -{% comment %} - -### Build tools - -{% endcomment %} - ### 构建工具 - [sbt](https://www.scala-sbt.org) - [Gradle](https://gradle.org) - [Mill](https://github.com/lihaoyi/mill) -{% comment %} - -## Summary - -As this page shows, Scala has many terrific programming language features at a high level, at an everyday programming level, and through its developer ecosystem. - -{% endcomment %} - ## 总结 如此页所示,Scala 在高层、日常编程层面以及贯穿开发者生态系统都具有许多出色的编程语言特性。 diff --git a/_zh-cn/overviews/scala3-book/scala-for-java-devs.md b/_zh-cn/overviews/scala3-book/scala-for-java-devs.md index c659559bb2..f4e20aa4c2 100644 --- a/_zh-cn/overviews/scala3-book/scala-for-java-devs.md +++ b/_zh-cn/overviews/scala3-book/scala-for-java-devs.md @@ -2,7 +2,8 @@ title: 向 Java 开发者介绍Scala type: chapter description: This page is for Java developers who are interested in learning about Scala 3. -num: 73 +language: zh-cn +num: 72 previous-page: interacting-with-java next-page: scala-for-javascript-devs diff --git a/_zh-cn/overviews/scala3-book/scala-for-javascript-devs.md b/_zh-cn/overviews/scala3-book/scala-for-javascript-devs.md index 3e80ad15e9..4563c43af4 100644 --- a/_zh-cn/overviews/scala3-book/scala-for-javascript-devs.md +++ b/_zh-cn/overviews/scala3-book/scala-for-javascript-devs.md @@ -2,7 +2,8 @@ title: Scala for JavaScript Developers type: chapter description: This chapter provides an introduction to Scala 3 for JavaScript developers -num: 74 +language: zh-cn +num: 73 previous-page: scala-for-java-devs next-page: scala-for-python-devs diff --git a/_zh-cn/overviews/scala3-book/scala-for-python-devs.md b/_zh-cn/overviews/scala3-book/scala-for-python-devs.md index f3e17233f1..2ea3bacf3d 100644 --- a/_zh-cn/overviews/scala3-book/scala-for-python-devs.md +++ b/_zh-cn/overviews/scala3-book/scala-for-python-devs.md @@ -2,9 +2,10 @@ title: Scala for Python Developers type: chapter description: This page is for Python developers who are interested in learning about Scala 3. -num: 75 +language: zh-cn +num: 74 previous-page: scala-for-javascript-devs -next-page: +next-page: where-next partof: scala3-book overview-name: "Scala 3 — Book" @@ -1309,7 +1310,9 @@ a.takeWhile(_ < 30) // List(10, 20) Scala 中的有些概念目前在 Python 中没有等效的功能。 请点击以下链接了解更多详情: -- 大多数与[上下文抽象][contextual]相关的概念,如[扩展方法][extension-methods]、[类型类][type-classes]、隐式值 + + +- 大多数与[上下文抽象][contextual]相关的概念,如[扩展方法][extension-methods]、类型类、隐式值 - Scala 允许多参数列表,从而实现部分应用函数等特性,以及创建自己的 DSL 的能力 - 样例类,对于函数式编程和模式匹配非常有用 - 创建自己的控制结构和 DSL 的能力 @@ -1354,6 +1357,5 @@ pip install -r requirements.txt [modeling-intro]: {% link _zh-cn/overviews/scala3-book/domain-modeling-intro.md %} [multiversal]: {% link _zh-cn/overviews/scala3-book/ca-multiversal-equality.md %} [toplevel]: {% link _zh-cn/overviews/scala3-book/taste-toplevel-definitions.md %} -[type-classes]: {% link _zh-cn/overviews/scala3-book/types-type-classes.md %} [union-types]: {% link _zh-cn/overviews/scala3-book/types-union.md %} diff --git a/_zh-cn/overviews/scala3-book/scala-tools.md b/_zh-cn/overviews/scala3-book/scala-tools.md index 0362ffcc0e..d773d0f837 100644 --- a/_zh-cn/overviews/scala3-book/scala-tools.md +++ b/_zh-cn/overviews/scala3-book/scala-tools.md @@ -2,7 +2,8 @@ title: Scala 工具 type: chapter description: This chapter looks at two commonly-used Scala tools, sbt and ScalaTest. -num: 69 +language: zh-cn +num: 68 previous-page: concurrency next-page: tools-sbt diff --git a/_zh-cn/overviews/scala3-book/taste-collections.md b/_zh-cn/overviews/scala3-book/taste-collections.md index bd5f02cb01..d6b987a7a6 100644 --- a/_zh-cn/overviews/scala3-book/taste-collections.md +++ b/_zh-cn/overviews/scala3-book/taste-collections.md @@ -2,6 +2,7 @@ title: Collections type: section description: This page provides a high-level overview of the main features of the Scala 3 programming language. +language: zh-cn num: 13 previous-page: taste-objects next-page: taste-contextual-abstractions diff --git a/_zh-cn/overviews/scala3-book/taste-contextual-abstractions.md b/_zh-cn/overviews/scala3-book/taste-contextual-abstractions.md index b354a6a9f5..d5610c6872 100644 --- a/_zh-cn/overviews/scala3-book/taste-contextual-abstractions.md +++ b/_zh-cn/overviews/scala3-book/taste-contextual-abstractions.md @@ -2,6 +2,7 @@ title: Contextual Abstractions type: section description: This section provides an introduction to Contextual Abstractions in Scala 3. +language: zh-cn num: 14 previous-page: taste-collections next-page: taste-toplevel-definitions diff --git a/_zh-cn/overviews/scala3-book/taste-control-structures.md b/_zh-cn/overviews/scala3-book/taste-control-structures.md index 5efa015ee3..ea26f0ff42 100644 --- a/_zh-cn/overviews/scala3-book/taste-control-structures.md +++ b/_zh-cn/overviews/scala3-book/taste-control-structures.md @@ -2,6 +2,7 @@ title: 控制结构 type: section description: This section demonstrates Scala 3 control structures. +language: zh-cn num: 8 previous-page: taste-vars-data-types next-page: taste-modeling diff --git a/_zh-cn/overviews/scala3-book/taste-functions.md b/_zh-cn/overviews/scala3-book/taste-functions.md index 6947dfcb69..9c52d09213 100644 --- a/_zh-cn/overviews/scala3-book/taste-functions.md +++ b/_zh-cn/overviews/scala3-book/taste-functions.md @@ -2,6 +2,7 @@ title: First-Class Functions type: section description: This page provides an introduction to functions in Scala 3. +language: zh-cn num: 11 previous-page: taste-methods next-page: taste-objects diff --git a/_zh-cn/overviews/scala3-book/taste-hello-world.md b/_zh-cn/overviews/scala3-book/taste-hello-world.md index 686e2187fc..cebe30f7fa 100644 --- a/_zh-cn/overviews/scala3-book/taste-hello-world.md +++ b/_zh-cn/overviews/scala3-book/taste-hello-world.md @@ -2,6 +2,7 @@ title: Hello, World! type: section description: This section demonstrates a Scala 3 'Hello, World!' example. +language: zh-cn num: 5 previous-page: taste-intro next-page: taste-repl @@ -198,4 +199,4 @@ import scala.io.StdIn.readLine - 您可以使用包含有用功能的代码库,该库可能是由其他人编写 - 您可以知道某个定义的来源(特别是如果它没有写入当前文件)。 -[scala_tools]: {% link _zh-cn/overviews/scala3-book/scala-tools.md %} \ No newline at end of file +[scala_tools]: {% link _zh-cn/overviews/scala3-book/scala-tools.md %} diff --git a/_zh-cn/overviews/scala3-book/taste-intro.md b/_zh-cn/overviews/scala3-book/taste-intro.md index 1aa0b92bcb..df7fed74bd 100644 --- a/_zh-cn/overviews/scala3-book/taste-intro.md +++ b/_zh-cn/overviews/scala3-book/taste-intro.md @@ -2,6 +2,7 @@ title: Scala 的味道 type: chapter description: This chapter provides a high-level overview of the main features of the Scala 3 programming language. +language: zh-cn num: 4 previous-page: why-scala-3 next-page: taste-hello-world diff --git a/_zh-cn/overviews/scala3-book/taste-methods.md b/_zh-cn/overviews/scala3-book/taste-methods.md index fb1da65c2f..10e57ece93 100644 --- a/_zh-cn/overviews/scala3-book/taste-methods.md +++ b/_zh-cn/overviews/scala3-book/taste-methods.md @@ -2,6 +2,7 @@ title: Methods type: section description: This section provides an introduction to defining and using methods in Scala 3. +language: zh-cn num: 10 previous-page: taste-modeling next-page: taste-functions diff --git a/_zh-cn/overviews/scala3-book/taste-modeling.md b/_zh-cn/overviews/scala3-book/taste-modeling.md index 2ade36d68d..57981e10d3 100644 --- a/_zh-cn/overviews/scala3-book/taste-modeling.md +++ b/_zh-cn/overviews/scala3-book/taste-modeling.md @@ -2,6 +2,7 @@ title: 领域建模 type: section description: This section provides an introduction to data modeling in Scala 3. +language: zh-cn num: 9 previous-page: taste-control-structures next-page: taste-methods diff --git a/_zh-cn/overviews/scala3-book/taste-objects.md b/_zh-cn/overviews/scala3-book/taste-objects.md index 10b5e80d47..e24d759a24 100644 --- a/_zh-cn/overviews/scala3-book/taste-objects.md +++ b/_zh-cn/overviews/scala3-book/taste-objects.md @@ -2,6 +2,7 @@ title: 单例对象 type: section description: This section provides an introduction to the use of singleton objects in Scala 3. +language: zh-cn num: 12 previous-page: taste-functions next-page: taste-collections diff --git a/_zh-cn/overviews/scala3-book/taste-repl.md b/_zh-cn/overviews/scala3-book/taste-repl.md index 8e8599db9f..2b043bef03 100644 --- a/_zh-cn/overviews/scala3-book/taste-repl.md +++ b/_zh-cn/overviews/scala3-book/taste-repl.md @@ -2,6 +2,7 @@ title: The REPL type: section description: This section provides an introduction to the Scala REPL. +language: zh-cn num: 6 previous-page: taste-hello-world next-page: taste-vars-data-types diff --git a/_zh-cn/overviews/scala3-book/taste-summary.md b/_zh-cn/overviews/scala3-book/taste-summary.md index dd320bea58..14c44c9bde 100644 --- a/_zh-cn/overviews/scala3-book/taste-summary.md +++ b/_zh-cn/overviews/scala3-book/taste-summary.md @@ -2,6 +2,7 @@ title: Summary type: section description: This page provides a summary of the previous 'Taste of Scala' sections. +language: zh-cn num: 16 previous-page: taste-toplevel-definitions next-page: first-look-at-types diff --git a/_zh-cn/overviews/scala3-book/taste-toplevel-definitions.md b/_zh-cn/overviews/scala3-book/taste-toplevel-definitions.md index e36a35adc6..11b577896f 100644 --- a/_zh-cn/overviews/scala3-book/taste-toplevel-definitions.md +++ b/_zh-cn/overviews/scala3-book/taste-toplevel-definitions.md @@ -2,6 +2,7 @@ title: Toplevel Definitions type: section description: This page provides an introduction to top-level definitions in Scala 3 +language: zh-cn num: 15 previous-page: taste-contextual-abstractions next-page: taste-summary diff --git a/_zh-cn/overviews/scala3-book/taste-vars-data-types.md b/_zh-cn/overviews/scala3-book/taste-vars-data-types.md index 9ac7ab79b0..2c5a80e5a0 100644 --- a/_zh-cn/overviews/scala3-book/taste-vars-data-types.md +++ b/_zh-cn/overviews/scala3-book/taste-vars-data-types.md @@ -2,6 +2,7 @@ title: 变量和数据类型 type: section description: This section demonstrates val and var variables, and some common Scala data types. +language: zh-cn num: 7 previous-page: taste-repl next-page: taste-control-structures @@ -289,4 +290,4 @@ val quote = """The essence of Scala: > 有关字符串插值器和多行字符串的更多详细信息,请参阅[“类型初探”章节][first-look]。 -[first-look]: {% link _zh-cn/overviews/scala3-book/first-look-at-types.md %} \ No newline at end of file +[first-look]: {% link _zh-cn/overviews/scala3-book/first-look-at-types.md %} diff --git a/_zh-cn/overviews/scala3-book/tools-sbt.md b/_zh-cn/overviews/scala3-book/tools-sbt.md index 7e19cb629f..362de902b4 100644 --- a/_zh-cn/overviews/scala3-book/tools-sbt.md +++ b/_zh-cn/overviews/scala3-book/tools-sbt.md @@ -2,7 +2,8 @@ title: 使用 sbt 构建和测试 Scala 项目 type: section description: This section looks at a commonly-used build tool, sbt, and a testing library, ScalaTest. -num: 70 +language: zh-cn +num: 69 previous-page: scala-tools next-page: tools-worksheets diff --git a/_zh-cn/overviews/scala3-book/tools-worksheets.md b/_zh-cn/overviews/scala3-book/tools-worksheets.md index 811bc2763e..2e8270c996 100644 --- a/_zh-cn/overviews/scala3-book/tools-worksheets.md +++ b/_zh-cn/overviews/scala3-book/tools-worksheets.md @@ -2,7 +2,8 @@ title: worksheet type: section description: This section looks at worksheets, an alternative to Scala projects. -num: 71 +language: zh-cn +num: 70 previous-page: tools-sbt next-page: interacting-with-java diff --git a/_zh-cn/overviews/scala3-book/types-adts-gadts.md b/_zh-cn/overviews/scala3-book/types-adts-gadts.md index 367e77394d..9d3e469333 100644 --- a/_zh-cn/overviews/scala3-book/types-adts-gadts.md +++ b/_zh-cn/overviews/scala3-book/types-adts-gadts.md @@ -2,6 +2,7 @@ title: 代数数据类型 type: section description: This section introduces and demonstrates algebraic data types (ADTs) in Scala 3. +language: zh-cn num: 52 previous-page: types-union next-page: types-variance diff --git a/_zh-cn/overviews/scala3-book/types-dependent-function.md b/_zh-cn/overviews/scala3-book/types-dependent-function.md index 1b9c29ebcf..fa5c8d8c82 100644 --- a/_zh-cn/overviews/scala3-book/types-dependent-function.md +++ b/_zh-cn/overviews/scala3-book/types-dependent-function.md @@ -2,6 +2,7 @@ title: 依赖函数类型 type: section description: This section introduces and demonstrates dependent function types in Scala 3. +language: zh-cn num: 56 previous-page: types-structural next-page: types-others diff --git a/_zh-cn/overviews/scala3-book/types-generics.md b/_zh-cn/overviews/scala3-book/types-generics.md index 484327c62c..45fb52865b 100644 --- a/_zh-cn/overviews/scala3-book/types-generics.md +++ b/_zh-cn/overviews/scala3-book/types-generics.md @@ -2,6 +2,7 @@ title: 泛型 type: section description: This section introduces and demonstrates generics in Scala 3. +language: zh-cn num: 49 previous-page: types-inferred next-page: types-intersection diff --git a/_zh-cn/overviews/scala3-book/types-inferred.md b/_zh-cn/overviews/scala3-book/types-inferred.md index 8954a93cc4..ba52c8a9ce 100644 --- a/_zh-cn/overviews/scala3-book/types-inferred.md +++ b/_zh-cn/overviews/scala3-book/types-inferred.md @@ -2,6 +2,7 @@ title: 类型推断 type: section description: This section introduces and demonstrates inferred types in Scala 3 +language: zh-cn num: 48 previous-page: types-introduction next-page: types-generics diff --git a/_zh-cn/overviews/scala3-book/types-intersection.md b/_zh-cn/overviews/scala3-book/types-intersection.md index 711ad81a01..085c92c893 100644 --- a/_zh-cn/overviews/scala3-book/types-intersection.md +++ b/_zh-cn/overviews/scala3-book/types-intersection.md @@ -2,6 +2,7 @@ title: 相交类型 type: section description: This section introduces and demonstrates intersection types in Scala 3. +language: zh-cn num: 50 previous-page: types-generics next-page: types-union diff --git a/_zh-cn/overviews/scala3-book/types-introduction.md b/_zh-cn/overviews/scala3-book/types-introduction.md index 6a425da596..2acc837a59 100644 --- a/_zh-cn/overviews/scala3-book/types-introduction.md +++ b/_zh-cn/overviews/scala3-book/types-introduction.md @@ -2,6 +2,7 @@ title: 类型和类型系统 type: chapter description: This chapter provides an introduction to Scala 3 types and the type system. +language: zh-cn num: 47 previous-page: fp-summary next-page: types-inferred diff --git a/_zh-cn/overviews/scala3-book/types-opaque-types.md b/_zh-cn/overviews/scala3-book/types-opaque-types.md index eab037e2c3..f68f798641 100644 --- a/_zh-cn/overviews/scala3-book/types-opaque-types.md +++ b/_zh-cn/overviews/scala3-book/types-opaque-types.md @@ -2,6 +2,7 @@ title: 不透明类型 type: section description: This section introduces and demonstrates opaque types in Scala 3. +language: zh-cn num: 54 previous-page: types-variance next-page: types-structural diff --git a/_zh-cn/overviews/scala3-book/types-others.md b/_zh-cn/overviews/scala3-book/types-others.md index 8861090281..cb09102805 100644 --- a/_zh-cn/overviews/scala3-book/types-others.md +++ b/_zh-cn/overviews/scala3-book/types-others.md @@ -2,6 +2,7 @@ title: 其他类型 type: section description: This section mentions other advanced types in Scala 3. +language: zh-cn num: 57 previous-page: types-dependent-function next-page: ca-contextual-abstractions-intro diff --git a/_zh-cn/overviews/scala3-book/types-structural.md b/_zh-cn/overviews/scala3-book/types-structural.md index 3ea74afdda..694da0c635 100644 --- a/_zh-cn/overviews/scala3-book/types-structural.md +++ b/_zh-cn/overviews/scala3-book/types-structural.md @@ -2,6 +2,7 @@ title: 结构化类型 type: section description: This section introduces and demonstrates structural types in Scala 3. +language: zh-cn num: 55 previous-page: types-opaque-types next-page: types-dependent-function diff --git a/_zh-cn/overviews/scala3-book/types-type-classes.md b/_zh-cn/overviews/scala3-book/types-type-classes.md deleted file mode 100644 index 331b83f2ab..0000000000 --- a/_zh-cn/overviews/scala3-book/types-type-classes.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: Type Classes -type: section -description: This section introduces type classes in Scala 3. -num: 60 -previous-page: ca-given-using-clauses -next-page: ca-context-bounds - -partof: scala3-book -overview-name: "Scala 3 — Book" -layout: multipage-overview -permalink: "/zh-cn/scala3/book/:title.html" ---- - -A _type class_ is an abstract, parameterized type that lets you add new behavior to any closed data type without using sub-typing. -If you are coming from Java, you can think of type classes as something like [`java.util.Comparator[T]`][comparator]. - -> The paper [“Type Classes as Objects and Implicits”][typeclasses-paper] (2010) by Oliveira et al. discusses the basic ideas behind type classes in Scala. -> Even though the paper uses an older version of Scala, the ideas still hold to the current day. - -This style of programming is useful in multiple use-cases, for example: - -- Expressing how a type you don’t own---such as from the standard library or a third-party library---conforms to such behavior -- Adding behavior to multiple types without introducing sub-typing relationships between those types (i.e., one `extends` another) - -In Scala 3, _type classes_ are just _traits_ with one or more type parameters, like the following: -``` -trait Show[A]: - def show(a: A): String -``` -Instances of `Show` for a particular type `A` witness that we can show (i.e., produce a text representation of) an instance of type `A`. -For example, let’s look at the following `Show` instance for `Int` values: - -```scala -class ShowInt extends Show[Int]: - def show(a: Int) = s"The number is ${a}!" -``` -We can write methods that work on arbitrary types `A` _constrained_ by `Show` as follows: - -```scala -def toHtml[A](a: A)(showA: Show[A]): String = - "
" + showA.show(a) + "
" -``` -That is, `toHtml` can be called with arbitrary `A` _as long_ as you can also provide an instance of `Show[A]`. -For example, we can call it like: -```scala -toHtml(42)(ShowInt()) -// results in "The number is 42!
" -``` - -#### Automatically passing type class instances -Since type classes are a very important way to structure software, Scala 3 offers additional features that make working with them very convenient. -We discuss these additional features (which fall into the category of *Contextual Abstractions*) in a [later chapter][typeclasses-chapter] of this book. - -[typeclasses-paper]: https://infoscience.epfl.ch/record/150280/files/TypeClasses.pdf -[typeclasses-chapter]: {% link _zh-cn/overviews/scala3-book/ca-type-classes.md %} -[comparator]: https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html diff --git a/_zh-cn/overviews/scala3-book/types-union.md b/_zh-cn/overviews/scala3-book/types-union.md index 826fc63acd..204b1fcccb 100644 --- a/_zh-cn/overviews/scala3-book/types-union.md +++ b/_zh-cn/overviews/scala3-book/types-union.md @@ -2,6 +2,7 @@ title: 联合类型 type: section description: This section introduces and demonstrates union types in Scala 3. +language: zh-cn num: 51 previous-page: types-intersection next-page: types-adts-gadts diff --git a/_zh-cn/overviews/scala3-book/types-variance.md b/_zh-cn/overviews/scala3-book/types-variance.md index 9b6274d6ec..f4b9ce2fa3 100644 --- a/_zh-cn/overviews/scala3-book/types-variance.md +++ b/_zh-cn/overviews/scala3-book/types-variance.md @@ -2,6 +2,7 @@ title: 型变 type: section description: This section introduces and demonstrates variance in Scala 3. +language: zh-cn num: 53 previous-page: types-adts-gadts next-page: types-opaque-types diff --git a/_zh-cn/overviews/scala3-book/where-next.md b/_zh-cn/overviews/scala3-book/where-next.md index 3cd5a6e729..e1d6052b6b 100644 --- a/_zh-cn/overviews/scala3-book/where-next.md +++ b/_zh-cn/overviews/scala3-book/where-next.md @@ -2,7 +2,8 @@ title: 下一步去哪 type: chapter description: Where to go next after reading the Scala Book -num: 76 +language: zh-cn +num: 75 previous-page: scala-for-python-devs next-page: diff --git a/_zh-cn/overviews/scala3-book/why-scala-3.md b/_zh-cn/overviews/scala3-book/why-scala-3.md index ce9eba7084..2259ad6c01 100644 --- a/_zh-cn/overviews/scala3-book/why-scala-3.md +++ b/_zh-cn/overviews/scala3-book/why-scala-3.md @@ -2,6 +2,7 @@ title: 为什么是 Scala 3 ? type: chapter description: This page describes the benefits of the Scala 3 programming language. +language: zh-cn num: 3 previous-page: scala-features next-page: taste-intro