diff --git a/_overviews/scala3-book/ca-context-bounds.md b/_overviews/scala3-book/ca-context-bounds.md index b42f71e56d..bb4debc7c8 100644 --- a/_overviews/scala3-book/ca-context-bounds.md +++ b/_overviews/scala3-book/ca-context-bounds.md @@ -2,7 +2,7 @@ title: Context Bounds type: section description: This page demonstrates Context Bounds in Scala 3. -num: 61 +num: 62 previous-page: types-type-classes next-page: ca-given-imports --- diff --git a/_overviews/scala3-book/ca-contextual-abstractions-intro.md b/_overviews/scala3-book/ca-contextual-abstractions-intro.md index dc14d90c62..e420780ae5 100644 --- a/_overviews/scala3-book/ca-contextual-abstractions-intro.md +++ b/_overviews/scala3-book/ca-contextual-abstractions-intro.md @@ -2,7 +2,7 @@ title: Contextual Abstractions type: chapter description: This chapter provides an introduction to the Scala 3 concept of Contextual Abstractions. -num: 58 +num: 59 previous-page: types-others next-page: ca-given-using-clauses --- diff --git a/_overviews/scala3-book/ca-extension-methods.md b/_overviews/scala3-book/ca-extension-methods.md index b066aea99e..e52af02797 100644 --- a/_overviews/scala3-book/ca-extension-methods.md +++ b/_overviews/scala3-book/ca-extension-methods.md @@ -2,7 +2,7 @@ title: Extension Methods type: section description: This page demonstrates how Extension Methods work in Scala 3. -num: 63 +num: 64 previous-page: ca-given-imports next-page: ca-type-classes --- diff --git a/_overviews/scala3-book/ca-given-imports.md b/_overviews/scala3-book/ca-given-imports.md index 6cfb436a29..f11aca4b5e 100644 --- a/_overviews/scala3-book/ca-given-imports.md +++ b/_overviews/scala3-book/ca-given-imports.md @@ -2,7 +2,7 @@ title: Given Imports type: section description: This page demonstrates how 'given' import statements work in Scala 3. -num: 62 +num: 63 previous-page: ca-context-bounds next-page: ca-extension-methods --- diff --git a/_overviews/scala3-book/ca-given-using-clauses.md b/_overviews/scala3-book/ca-given-using-clauses.md index 704f83bd82..96c85a0c94 100644 --- a/_overviews/scala3-book/ca-given-using-clauses.md +++ b/_overviews/scala3-book/ca-given-using-clauses.md @@ -2,7 +2,7 @@ title: Given Instances and Using Clauses type: section description: This page demonstrates how to use 'given' instances and 'using' clauses in Scala 3. -num: 59 +num: 60 previous-page: ca-contextual-abstractions-intro next-page: types-type-classes --- diff --git a/_overviews/scala3-book/ca-implicit-conversions.md b/_overviews/scala3-book/ca-implicit-conversions.md index d04cefa104..e2c60e1de7 100644 --- a/_overviews/scala3-book/ca-implicit-conversions.md +++ b/_overviews/scala3-book/ca-implicit-conversions.md @@ -2,7 +2,7 @@ title: Implicit Conversions type: section description: This page demonstrates how to implement Implicit Conversions in Scala 3. -num: 66 +num: 67 previous-page: ca-multiversal-equality next-page: ca-summary --- diff --git a/_overviews/scala3-book/ca-multiversal-equality.md b/_overviews/scala3-book/ca-multiversal-equality.md index a106ed0856..62c50e3d9b 100644 --- a/_overviews/scala3-book/ca-multiversal-equality.md +++ b/_overviews/scala3-book/ca-multiversal-equality.md @@ -2,7 +2,7 @@ title: Multiversal Equality type: section description: This page demonstrates how to implement Multiversal Equality in Scala 3. -num: 65 +num: 66 previous-page: ca-type-classes next-page: ca-implicit-conversions --- diff --git a/_overviews/scala3-book/ca-summary.md b/_overviews/scala3-book/ca-summary.md index ef0bc9fea4..cd2a8352e1 100644 --- a/_overviews/scala3-book/ca-summary.md +++ b/_overviews/scala3-book/ca-summary.md @@ -2,7 +2,7 @@ title: Summary type: section description: This page provides a summary of the Contextual Abstractions lessons. -num: 67 +num: 68 previous-page: ca-implicit-conversions next-page: concurrency --- diff --git a/_overviews/scala3-book/ca-type-classes.md b/_overviews/scala3-book/ca-type-classes.md index ee4cc4d1d7..b29c3bee7d 100644 --- a/_overviews/scala3-book/ca-type-classes.md +++ b/_overviews/scala3-book/ca-type-classes.md @@ -2,7 +2,7 @@ title: Implementing Type Classes type: section description: This page demonstrates how to create and use type classes in Scala 3. -num: 64 +num: 65 previous-page: ca-extension-methods next-page: ca-multiversal-equality --- diff --git a/_overviews/scala3-book/collections-classes.md b/_overviews/scala3-book/collections-classes.md index e9b7adec45..081947c483 100644 --- a/_overviews/scala3-book/collections-classes.md +++ b/_overviews/scala3-book/collections-classes.md @@ -2,7 +2,7 @@ title: Collections Types type: section description: This page introduces the common Scala 3 collections types and some of their methods. -num: 37 +num: 38 previous-page: collections-intro next-page: collections-methods --- diff --git a/_overviews/scala3-book/collections-intro.md b/_overviews/scala3-book/collections-intro.md index 7ecf0a835e..54cb1424b5 100644 --- a/_overviews/scala3-book/collections-intro.md +++ b/_overviews/scala3-book/collections-intro.md @@ -2,7 +2,7 @@ title: Scala Collections type: chapter description: This page provides and introduction to the common collections classes and their methods in Scala 3. -num: 36 +num: 37 previous-page: packaging-imports next-page: collections-classes --- diff --git a/_overviews/scala3-book/collections-methods.md b/_overviews/scala3-book/collections-methods.md index 4316dea761..73efbeb1f2 100644 --- a/_overviews/scala3-book/collections-methods.md +++ b/_overviews/scala3-book/collections-methods.md @@ -2,7 +2,7 @@ title: Collections Methods type: section description: This page demonstrates the common methods on the Scala 3 collections classes. -num: 38 +num: 39 previous-page: collections-classes next-page: collections-summary --- diff --git a/_overviews/scala3-book/collections-summary.md b/_overviews/scala3-book/collections-summary.md index 32aa74cd0c..befd69c81a 100644 --- a/_overviews/scala3-book/collections-summary.md +++ b/_overviews/scala3-book/collections-summary.md @@ -2,7 +2,7 @@ title: Summary type: section description: This page provides a summary of the Collections chapter. -num: 39 +num: 40 previous-page: collections-methods next-page: fp-intro --- diff --git a/_overviews/scala3-book/concurrency.md b/_overviews/scala3-book/concurrency.md index bda65f21a9..810b8df536 100644 --- a/_overviews/scala3-book/concurrency.md +++ b/_overviews/scala3-book/concurrency.md @@ -2,7 +2,7 @@ title: Concurrency type: chapter description: This page discusses how Scala concurrency works, with an emphasis on Scala Futures. -num: 68 +num: 69 previous-page: ca-summary next-page: scala-tools --- diff --git a/_overviews/scala3-book/control-structures.md b/_overviews/scala3-book/control-structures.md index 8b0500243e..c9a38933e8 100644 --- a/_overviews/scala3-book/control-structures.md +++ b/_overviews/scala3-book/control-structures.md @@ -2,7 +2,7 @@ title: Control Structures 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. -num: 18 +num: 19 previous-page: first-look-at-types next-page: domain-modeling-intro --- diff --git a/_overviews/scala3-book/domain-modeling-fp.md b/_overviews/scala3-book/domain-modeling-fp.md index 50576789c7..6fda72d4b1 100644 --- a/_overviews/scala3-book/domain-modeling-fp.md +++ b/_overviews/scala3-book/domain-modeling-fp.md @@ -2,7 +2,7 @@ title: FP Modeling type: section description: This chapter provides an introduction to FP domain modeling with Scala 3. -num: 22 +num: 23 previous-page: domain-modeling-oop next-page: methods-intro --- diff --git a/_overviews/scala3-book/domain-modeling-intro.md b/_overviews/scala3-book/domain-modeling-intro.md index 6707e9ddfe..81b60742b9 100644 --- a/_overviews/scala3-book/domain-modeling-intro.md +++ b/_overviews/scala3-book/domain-modeling-intro.md @@ -2,7 +2,7 @@ title: Domain Modeling type: chapter description: This chapter provides an introduction to domain modeling in Scala 3. -num: 19 +num: 20 previous-page: control-structures next-page: domain-modeling-tools --- diff --git a/_overviews/scala3-book/domain-modeling-oop.md b/_overviews/scala3-book/domain-modeling-oop.md index 744a45023a..b12817601a 100644 --- a/_overviews/scala3-book/domain-modeling-oop.md +++ b/_overviews/scala3-book/domain-modeling-oop.md @@ -2,7 +2,7 @@ title: OOP Modeling type: section description: This chapter provides an introduction to OOP domain modeling with Scala 3. -num: 21 +num: 22 previous-page: domain-modeling-tools next-page: domain-modeling-fp --- diff --git a/_overviews/scala3-book/domain-modeling-tools.md b/_overviews/scala3-book/domain-modeling-tools.md index f69bad4871..e0d1c37df3 100644 --- a/_overviews/scala3-book/domain-modeling-tools.md +++ b/_overviews/scala3-book/domain-modeling-tools.md @@ -2,7 +2,7 @@ title: Tools type: section description: This chapter provides an introduction to the available domain modeling tools in Scala 3, including classes, traits, enums, and more. -num: 20 +num: 21 previous-page: domain-modeling-intro next-page: domain-modeling-oop --- diff --git a/_overviews/scala3-book/first-look-at-types.md b/_overviews/scala3-book/first-look-at-types.md index 9ae69afd3a..2f7334cf38 100644 --- a/_overviews/scala3-book/first-look-at-types.md +++ b/_overviews/scala3-book/first-look-at-types.md @@ -2,7 +2,7 @@ title: A First Look at Types 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. -num: 17 +num: 18 previous-page: taste-summary next-page: control-structures --- diff --git a/_overviews/scala3-book/fp-functional-error-handling.md b/_overviews/scala3-book/fp-functional-error-handling.md index 41410e5cf1..3f1b3a7301 100644 --- a/_overviews/scala3-book/fp-functional-error-handling.md +++ b/_overviews/scala3-book/fp-functional-error-handling.md @@ -2,7 +2,7 @@ title: Functional Error Handling type: section description: This section provides an introduction to functional error handling in Scala 3. -num: 45 +num: 46 previous-page: fp-functions-are-values next-page: fp-summary --- diff --git a/_overviews/scala3-book/fp-functions-are-values.md b/_overviews/scala3-book/fp-functions-are-values.md index d2766c65fe..209d551956 100644 --- a/_overviews/scala3-book/fp-functions-are-values.md +++ b/_overviews/scala3-book/fp-functions-are-values.md @@ -2,7 +2,7 @@ title: Functions Are Values type: section description: This section looks at the use of functions as values in functional programming. -num: 44 +num: 45 previous-page: fp-pure-functions next-page: fp-functional-error-handling --- diff --git a/_overviews/scala3-book/fp-immutable-values.md b/_overviews/scala3-book/fp-immutable-values.md index c5a4cc3eb3..0381315fef 100644 --- a/_overviews/scala3-book/fp-immutable-values.md +++ b/_overviews/scala3-book/fp-immutable-values.md @@ -2,7 +2,7 @@ title: Immutable Values type: section description: This section looks at the use of immutable values in functional programming. -num: 42 +num: 43 previous-page: fp-what-is-fp next-page: fp-pure-functions --- diff --git a/_overviews/scala3-book/fp-intro.md b/_overviews/scala3-book/fp-intro.md index 03aed71900..b85c3010db 100644 --- a/_overviews/scala3-book/fp-intro.md +++ b/_overviews/scala3-book/fp-intro.md @@ -2,7 +2,7 @@ title: Functional Programming type: chapter description: This chapter provides an introduction to functional programming in Scala 3. -num: 40 +num: 41 previous-page: collections-summary next-page: fp-what-is-fp --- diff --git a/_overviews/scala3-book/fp-pure-functions.md b/_overviews/scala3-book/fp-pure-functions.md index 82199b14e0..d676112cad 100644 --- a/_overviews/scala3-book/fp-pure-functions.md +++ b/_overviews/scala3-book/fp-pure-functions.md @@ -2,7 +2,7 @@ title: Pure Functions type: section description: This section looks at the use of pure functions in functional programming. -num: 43 +num: 44 previous-page: fp-immutable-values next-page: fp-functions-are-values --- diff --git a/_overviews/scala3-book/fp-summary.md b/_overviews/scala3-book/fp-summary.md index 9857501e84..50841fe250 100644 --- a/_overviews/scala3-book/fp-summary.md +++ b/_overviews/scala3-book/fp-summary.md @@ -2,7 +2,7 @@ title: Summary type: section description: This section summarizes the previous functional programming sections. -num: 46 +num: 47 previous-page: fp-functional-error-handling next-page: types-introduction --- diff --git a/_overviews/scala3-book/fp-what-is-fp.md b/_overviews/scala3-book/fp-what-is-fp.md index 0b380447c8..8a772eacd6 100644 --- a/_overviews/scala3-book/fp-what-is-fp.md +++ b/_overviews/scala3-book/fp-what-is-fp.md @@ -2,7 +2,7 @@ title: What is Functional Programming? type: section description: This section provides an answer to the question, what is functional programming? -num: 41 +num: 42 previous-page: fp-intro next-page: fp-immutable-values --- diff --git a/_overviews/scala3-book/fun-anonymous-functions.md b/_overviews/scala3-book/fun-anonymous-functions.md index 39d87da216..3c93d29ab8 100644 --- a/_overviews/scala3-book/fun-anonymous-functions.md +++ b/_overviews/scala3-book/fun-anonymous-functions.md @@ -2,7 +2,7 @@ title: Anonymous Functions type: section description: This page shows how to use anonymous functions in Scala, including examples with the List class 'map' and 'filter' functions. -num: 28 +num: 29 previous-page: fun-intro next-page: fun-function-variables --- diff --git a/_overviews/scala3-book/fun-eta-expansion.md b/_overviews/scala3-book/fun-eta-expansion.md index d48e6c059b..f87983a296 100644 --- a/_overviews/scala3-book/fun-eta-expansion.md +++ b/_overviews/scala3-book/fun-eta-expansion.md @@ -2,7 +2,7 @@ title: Eta Expansion type: section description: This page discusses Eta Expansion, the Scala technology that automatically and transparently converts methods into functions. -num: 30 +num: 31 previous-page: fun-function-variables next-page: fun-hofs --- diff --git a/_overviews/scala3-book/fun-function-variables.md b/_overviews/scala3-book/fun-function-variables.md index 758a8568b7..ca0f9ccc19 100644 --- a/_overviews/scala3-book/fun-function-variables.md +++ b/_overviews/scala3-book/fun-function-variables.md @@ -2,7 +2,7 @@ title: Function Variables type: section description: This page shows how to use anonymous functions in Scala, including examples with the List class 'map' and 'filter' functions. -num: 29 +num: 30 previous-page: fun-anonymous-functions next-page: fun-eta-expansion --- diff --git a/_overviews/scala3-book/fun-hofs.md b/_overviews/scala3-book/fun-hofs.md index 0985c38ea2..2546197344 100644 --- a/_overviews/scala3-book/fun-hofs.md +++ b/_overviews/scala3-book/fun-hofs.md @@ -2,7 +2,7 @@ title: Higher-Order Functions type: section description: This page demonstrates how to create and use higher-order functions in Scala. -num: 31 +num: 32 previous-page: fun-eta-expansion next-page: fun-write-map-function --- diff --git a/_overviews/scala3-book/fun-intro.md b/_overviews/scala3-book/fun-intro.md index ba22b69d7a..bfe0905012 100644 --- a/_overviews/scala3-book/fun-intro.md +++ b/_overviews/scala3-book/fun-intro.md @@ -2,7 +2,7 @@ title: Functions type: chapter description: This chapter looks at all topics related to functions in Scala 3. -num: 27 +num: 28 previous-page: methods-summary next-page: fun-anonymous-functions --- diff --git a/_overviews/scala3-book/fun-summary.md b/_overviews/scala3-book/fun-summary.md index e2e9488629..4cd292874c 100644 --- a/_overviews/scala3-book/fun-summary.md +++ b/_overviews/scala3-book/fun-summary.md @@ -2,7 +2,7 @@ title: Summary type: section description: This page shows how to use anonymous functions in Scala, including examples with the List class 'map' and 'filter' functions. -num: 34 +num: 35 previous-page: fun-write-method-returns-function next-page: packaging-imports --- diff --git a/_overviews/scala3-book/fun-write-map-function.md b/_overviews/scala3-book/fun-write-map-function.md index 74cab95213..244e57f6ec 100644 --- a/_overviews/scala3-book/fun-write-map-function.md +++ b/_overviews/scala3-book/fun-write-map-function.md @@ -2,7 +2,7 @@ title: Write Your Own map Method type: section description: This page demonstrates how to create and use higher-order functions in Scala. -num: 32 +num: 33 previous-page: fun-hofs next-page: fun-write-method-returns-function --- diff --git a/_overviews/scala3-book/fun-write-method-returns-function.md b/_overviews/scala3-book/fun-write-method-returns-function.md index 825ad0cdfe..d254e65c1d 100644 --- a/_overviews/scala3-book/fun-write-method-returns-function.md +++ b/_overviews/scala3-book/fun-write-method-returns-function.md @@ -2,7 +2,7 @@ title: Creating a Method That Returns a Function type: section description: This page demonstrates how to create and use higher-order functions in Scala. -num: 33 +num: 34 previous-page: fun-write-map-function next-page: fun-summary --- diff --git a/_overviews/scala3-book/interacting-with-java.md b/_overviews/scala3-book/interacting-with-java.md index 300ebed689..a71dfb46a6 100644 --- a/_overviews/scala3-book/interacting-with-java.md +++ b/_overviews/scala3-book/interacting-with-java.md @@ -2,7 +2,7 @@ title: Interacting with 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 +num: 73 previous-page: tools-worksheets next-page: scala-for-java-devs --- diff --git a/_overviews/scala3-book/methods-intro.md b/_overviews/scala3-book/methods-intro.md index 1c1414746c..62b4329255 100644 --- a/_overviews/scala3-book/methods-intro.md +++ b/_overviews/scala3-book/methods-intro.md @@ -2,7 +2,7 @@ title: Methods type: chapter description: This section introduces methods in Scala 3. -num: 23 +num: 24 previous-page: domain-modeling-fp next-page: methods-most --- diff --git a/_overviews/scala3-book/methods-main-methods.md b/_overviews/scala3-book/methods-main-methods.md index e30da56dcd..5b76bfaeb1 100644 --- a/_overviews/scala3-book/methods-main-methods.md +++ b/_overviews/scala3-book/methods-main-methods.md @@ -2,7 +2,7 @@ title: main Methods type: section description: This page describes how 'main' methods and the '@main' annotation work in Scala 3. -num: 25 +num: 26 previous-page: methods-most next-page: methods-summary --- diff --git a/_overviews/scala3-book/methods-most.md b/_overviews/scala3-book/methods-most.md index 233c51b847..8475ed2e5d 100644 --- a/_overviews/scala3-book/methods-most.md +++ b/_overviews/scala3-book/methods-most.md @@ -2,7 +2,7 @@ title: Method Features type: section description: This section introduces Scala 3 methods, including main methods, extension methods, and more. -num: 24 +num: 25 previous-page: methods-intro next-page: methods-main-methods --- diff --git a/_overviews/scala3-book/methods-summary.md b/_overviews/scala3-book/methods-summary.md index 9894c6d4c9..408bca51bd 100644 --- a/_overviews/scala3-book/methods-summary.md +++ b/_overviews/scala3-book/methods-summary.md @@ -2,7 +2,7 @@ title: Summary type: section description: This section summarizes the previous sections on Scala 3 methods. -num: 26 +num: 27 previous-page: methods-main-methods next-page: fun-intro --- diff --git a/_overviews/scala3-book/packaging-imports.md b/_overviews/scala3-book/packaging-imports.md index e6e1aa7c91..d479a6d700 100644 --- a/_overviews/scala3-book/packaging-imports.md +++ b/_overviews/scala3-book/packaging-imports.md @@ -2,7 +2,7 @@ title: Packaging and Imports 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. -num: 35 +num: 36 previous-page: fun-summary next-page: collections-intro --- diff --git a/_overviews/scala3-book/scala-for-java-devs.md b/_overviews/scala3-book/scala-for-java-devs.md index fc7c8ab82b..1bc74bbedc 100644 --- a/_overviews/scala3-book/scala-for-java-devs.md +++ b/_overviews/scala3-book/scala-for-java-devs.md @@ -2,7 +2,7 @@ title: Scala for Java Developers type: chapter description: This page is for Java developers who are interested in learning about Scala 3. -num: 73 +num: 74 previous-page: interacting-with-java next-page: scala-for-javascript-devs --- diff --git a/_overviews/scala3-book/scala-for-javascript-devs.md b/_overviews/scala3-book/scala-for-javascript-devs.md index 462a1017ce..46ec182918 100644 --- a/_overviews/scala3-book/scala-for-javascript-devs.md +++ b/_overviews/scala3-book/scala-for-javascript-devs.md @@ -2,7 +2,7 @@ title: Scala for JavaScript Developers type: chapter description: This chapter provides an introduction to Scala 3 for JavaScript developers -num: 74 +num: 75 previous-page: scala-for-java-devs next-page: scala-for-python-devs --- diff --git a/_overviews/scala3-book/scala-for-python-devs.md b/_overviews/scala3-book/scala-for-python-devs.md index 0b11204ffa..804cda01ef 100644 --- a/_overviews/scala3-book/scala-for-python-devs.md +++ b/_overviews/scala3-book/scala-for-python-devs.md @@ -2,7 +2,7 @@ title: Scala for Python Developers type: chapter description: This page is for Python developers who are interested in learning about Scala 3. -num: 75 +num: 76 previous-page: scala-for-javascript-devs next-page: where-next --- diff --git a/_overviews/scala3-book/scala-tools.md b/_overviews/scala3-book/scala-tools.md index 52e4bc67b7..252d45c5a8 100644 --- a/_overviews/scala3-book/scala-tools.md +++ b/_overviews/scala3-book/scala-tools.md @@ -2,7 +2,7 @@ title: Scala Tools type: chapter description: This chapter looks at two commonly-used Scala tools, sbt and ScalaTest. -num: 69 +num: 70 previous-page: concurrency next-page: tools-sbt --- diff --git a/_overviews/scala3-book/taste-collections.md b/_overviews/scala3-book/taste-collections.md index fe1232914f..61c78c91d3 100644 --- a/_overviews/scala3-book/taste-collections.md +++ b/_overviews/scala3-book/taste-collections.md @@ -2,7 +2,7 @@ title: Collections type: section description: This page provides a high-level overview of the main features of the Scala 3 programming language. -num: 13 +num: 14 previous-page: taste-objects next-page: taste-contextual-abstractions --- diff --git a/_overviews/scala3-book/taste-contextual-abstractions.md b/_overviews/scala3-book/taste-contextual-abstractions.md index 097800b288..15efcac76d 100644 --- a/_overviews/scala3-book/taste-contextual-abstractions.md +++ b/_overviews/scala3-book/taste-contextual-abstractions.md @@ -2,7 +2,7 @@ title: Contextual Abstractions type: section description: This section provides an introduction to Contextual Abstractions in Scala 3. -num: 14 +num: 15 previous-page: taste-collections next-page: taste-toplevel-definitions --- diff --git a/_overviews/scala3-book/taste-control-structures.md b/_overviews/scala3-book/taste-control-structures.md index 13e55a4233..1036f010bb 100644 --- a/_overviews/scala3-book/taste-control-structures.md +++ b/_overviews/scala3-book/taste-control-structures.md @@ -2,8 +2,8 @@ title: Control Structures type: section description: This section demonstrates Scala 3 control structures. -num: 8 -previous-page: taste-vars-data-types +num: 9 +previous-page: taste-indentation-significant-syntax next-page: taste-modeling --- diff --git a/_overviews/scala3-book/taste-functions.md b/_overviews/scala3-book/taste-functions.md index b103dba666..a7cdeeb06b 100644 --- a/_overviews/scala3-book/taste-functions.md +++ b/_overviews/scala3-book/taste-functions.md @@ -2,7 +2,7 @@ title: First-Class Functions type: section description: This page provides an introduction to functions in Scala 3. -num: 11 +num: 12 previous-page: taste-methods next-page: taste-objects --- diff --git a/_overviews/scala3-book/taste-indentation-significant-syntax.md b/_overviews/scala3-book/taste-indentation-significant-syntax.md new file mode 100644 index 0000000000..08b55268a3 --- /dev/null +++ b/_overviews/scala3-book/taste-indentation-significant-syntax.md @@ -0,0 +1,189 @@ +--- +title: Indentation-Significant-syntax +type: section +description: This section shows that some lexical scopes can be delimited by indentation instead of braces. +num: 8 +previous-page: taste-vars-data-types +next-page: taste-control-structures +--- + +Indentation refers to the increase or decrease of space between the left and right margin of a paragraph. + + +In Scala, it is common practice that each level of indentation is 2 spaces. Thus, instead of +indenting like this: + + // wrong! + class Foo { + def fourspaces = { + val x = 4 + .. + } + } + +it is better to indent like this: + + // right! + class Foo { + def twospaces = { + val x = 2 + .. + } + } + +The Scala language encourages a startling amount of nested scopes and +logical blocks (function values and such). Do yourself a favor and don't +penalize yourself syntactically for opening up a new block. Coming from +Java, this style does take a bit of getting used to, but it is well +worth the effort. + +## Line Wrapping + +There are times when a single expression reaches a length where it +becomes unreadable to keep it confined to a single line (usually that +length is anywhere above 80 characters). In such cases, the *preferred* +approach is to simply split the expression up into multiple expressions +by assigning intermediate results to values. However, this is not +always a practical solution. + +When it is absolutely necessary to wrap an expression across more than +one line, each successive line should be indented two spaces from the +*first*. Also remember that Scala requires each "wrap line" to either +have an unclosed parenthetical or to end with an infix method in which +the right parameter is not given: + + val result = 1 + 2 + 3 + 4 + 5 + 6 + + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 15 + 16 + 17 + 18 + 19 + 20 + +Without this trailing method, Scala will infer a semi-colon at the end +of a line which was intended to wrap, throwing off the compilation +sometimes without even so much as a warning. + +## Methods with Numerous Arguments + +it is best practice to avoid any method which takes more than two or +three parameters! When calling a method which takes numerous arguments (in the range of +five or more),though, it is often necessary to wrap the method invocation onto +multiple lines. In such cases, put each argument on a line by +itself, indented two spaces from the current indent level: + + foo( + someVeryLongFieldName, + andAnotherVeryLongFieldName, + "this is a string", + 3.1415) + +This way, all parameters line up, and you don't need to re-align them if +you change the name of the method later on. + +Great care should be taken to avoid these sorts of invocations well into +the length of the line. More specifically, such an invocation should be +avoided when each parameter would have to be indented more than 50 +spaces to achieve alignment. In such cases, the invocation itself should +be moved to the next line and indented two spaces: + + // right! + val myLongFieldNameWithNoRealPoint = + foo( + someVeryLongFieldName, + andAnotherVeryLongFieldName, + "this is a string", + 3.1415) + + // wrong! + val myLongFieldNameWithNoRealPoint = foo(someVeryLongFieldName, + andAnotherVeryLongFieldName, + "this is a string", + 3.1415) + + +## Optional Braces + +The compiler will insert `` or `` +tokens at certain line breaks. Grammatically, pairs of `` and `` tokens have the same effect as pairs of braces `{` and `}`. + +The algorithm makes use of a stack `IW` of previously encountered indentation widths. The stack initially holds a single element with a zero indentation width. The _current indentation width_ is the indentation width of the top of the stack. + +There are two rules: + +1. An `` is inserted at a line break, if + + - An indentation region can start at the current position in the source, and + - the first token on the next line has an indentation width strictly greater + than the current indentation width + + An indentation region can start + + - after the leading parameters of an `extension`, or + - after a `with` in a given instance, or + - after a `:` at the start of a template body (see discussion of `` below), or + - after one of the following tokens: + + ``` + = => ?=> <- catch do else finally for + if match return then throw try while yield + ``` + + - after the closing `)` of a condition in an old-style `if` or `while`. + - after the closing `)` or `}` of the enumerations of an old-style `for` loop without a `do`. + + If an `` is inserted, the indentation width of the token on the next line + is pushed onto `IW`, which makes it the new current indentation width. + +2. An `` is inserted at a line break, if + + - the first token on the next line has an indentation width strictly less + than the current indentation width, and + - the last token on the previous line is not one of the following tokens + which indicate that the previous statement continues: + ``` + then else do catch finally yield match + ``` + - if the first token on the next line is a + [leading infix operator](../changed-features/operators.md). + then its indentation width is less then the current indentation width, + and it either matches a previous indentation width or is also less + than the enclosing indentation width. + + If an `` is inserted, the top element is popped from `IW`. + If the indentation width of the token on the next line is still less than the new current indentation width, step (2) repeats. Therefore, several `` tokens + may be inserted in a row. + + The following two additional rules support parsing of legacy code with ad-hoc layout. They might be withdrawn in future language versions: + + - An `` is also inserted if the next token following a statement sequence starting with an `` closes an indentation region, i.e. is one of `then`, `else`, `do`, `catch`, `finally`, `yield`, `}`, `)`, `]` or `case`. + + - An `` is finally inserted in front of a comma that follows a statement sequence starting with an `` if the indented region is itself enclosed in parentheses. + +It is an error if the indentation width of the token following an `` does not match the indentation of some previous line in the enclosing indentation region. For instance, the following would be rejected. + +```scala +if x < 0 then + -x + else // error: `else` does not align correctly + x +``` + +Indentation tokens are only inserted in regions where newline statement separators are also inferred: +at the top-level, inside braces `{...}`, but not inside parentheses `(...)`, patterns or types. + +**Note:** The rules for leading infix operators above are there to make sure that +```scala + one + + two.match + case 1 => b + case 2 => c + + three +``` +is parsed as `one + (two.match ...) + three`. Also, that +```scala +if x then + a + + b + + c +else d +``` +is parsed as `if x then a + b + c else d`. + +For more Information on optional braces indentation, check [Optional Braces](https://docs.scala-lang.org/scala3/reference/other-new-features/indentation.html). diff --git a/_overviews/scala3-book/taste-methods.md b/_overviews/scala3-book/taste-methods.md index 2718059bb1..bb9f6f7a60 100644 --- a/_overviews/scala3-book/taste-methods.md +++ b/_overviews/scala3-book/taste-methods.md @@ -2,7 +2,7 @@ title: Methods type: section description: This section provides an introduction to defining and using methods in Scala 3. -num: 10 +num: 11 previous-page: taste-modeling next-page: taste-functions --- diff --git a/_overviews/scala3-book/taste-modeling.md b/_overviews/scala3-book/taste-modeling.md index 20c605c6f9..4f2924c2b4 100644 --- a/_overviews/scala3-book/taste-modeling.md +++ b/_overviews/scala3-book/taste-modeling.md @@ -2,7 +2,7 @@ title: Domain Modeling type: section description: This section provides an introduction to data modeling in Scala 3. -num: 9 +num: 10 previous-page: taste-control-structures next-page: taste-methods --- diff --git a/_overviews/scala3-book/taste-objects.md b/_overviews/scala3-book/taste-objects.md index 4fbb325eb2..59fc3a3209 100644 --- a/_overviews/scala3-book/taste-objects.md +++ b/_overviews/scala3-book/taste-objects.md @@ -2,7 +2,7 @@ title: Singleton Objects type: section description: This section provides an introduction to the use of singleton objects in Scala 3. -num: 12 +num: 13 previous-page: taste-functions next-page: taste-collections --- diff --git a/_overviews/scala3-book/taste-summary.md b/_overviews/scala3-book/taste-summary.md index a80297b2d9..9d395c3cc7 100644 --- a/_overviews/scala3-book/taste-summary.md +++ b/_overviews/scala3-book/taste-summary.md @@ -2,7 +2,7 @@ title: Summary type: section description: This page provides a summary of the previous 'Taste of Scala' sections. -num: 16 +num: 17 previous-page: taste-toplevel-definitions next-page: first-look-at-types --- diff --git a/_overviews/scala3-book/taste-toplevel-definitions.md b/_overviews/scala3-book/taste-toplevel-definitions.md index 3d3a1385ed..403decee27 100644 --- a/_overviews/scala3-book/taste-toplevel-definitions.md +++ b/_overviews/scala3-book/taste-toplevel-definitions.md @@ -2,7 +2,7 @@ title: Toplevel Definitions type: section description: This page provides an introduction to top-level definitions in Scala 3 -num: 15 +num: 16 previous-page: taste-contextual-abstractions next-page: taste-summary --- diff --git a/_overviews/scala3-book/tools-sbt.md b/_overviews/scala3-book/tools-sbt.md index eb1ed8f0e6..dd31bb7eec 100644 --- a/_overviews/scala3-book/tools-sbt.md +++ b/_overviews/scala3-book/tools-sbt.md @@ -2,7 +2,7 @@ title: Building and Testing Scala Projects with sbt type: section description: This section looks at a commonly-used build tool, sbt, and a testing library, ScalaTest. -num: 70 +num: 71 previous-page: scala-tools next-page: tools-worksheets --- diff --git a/_overviews/scala3-book/tools-worksheets.md b/_overviews/scala3-book/tools-worksheets.md index 3231d4e654..afa4a2798c 100644 --- a/_overviews/scala3-book/tools-worksheets.md +++ b/_overviews/scala3-book/tools-worksheets.md @@ -2,7 +2,7 @@ title: Worksheets type: section description: This section looks at worksheets, an alternative to Scala projects. -num: 71 +num: 72 previous-page: tools-sbt next-page: interacting-with-java --- diff --git a/_overviews/scala3-book/types-adts-gadts.md b/_overviews/scala3-book/types-adts-gadts.md index 19d9641b4a..47a011d43f 100644 --- a/_overviews/scala3-book/types-adts-gadts.md +++ b/_overviews/scala3-book/types-adts-gadts.md @@ -2,7 +2,7 @@ title: Algebraic Data Types type: section description: This section introduces and demonstrates algebraic data types (ADTs) in Scala 3. -num: 52 +num: 53 previous-page: types-union next-page: types-variance --- diff --git a/_overviews/scala3-book/types-dependent-function.md b/_overviews/scala3-book/types-dependent-function.md index e70ed26045..25296b5cac 100644 --- a/_overviews/scala3-book/types-dependent-function.md +++ b/_overviews/scala3-book/types-dependent-function.md @@ -2,7 +2,7 @@ title: Dependent Function Types type: section description: This section introduces and demonstrates dependent function types in Scala 3. -num: 56 +num: 57 previous-page: types-structural next-page: types-others --- diff --git a/_overviews/scala3-book/types-generics.md b/_overviews/scala3-book/types-generics.md index 004e82e8e5..893a4733eb 100644 --- a/_overviews/scala3-book/types-generics.md +++ b/_overviews/scala3-book/types-generics.md @@ -2,7 +2,7 @@ title: Generics type: section description: This section introduces and demonstrates generics in Scala 3. -num: 49 +num: 50 previous-page: types-inferred next-page: types-intersection --- diff --git a/_overviews/scala3-book/types-inferred.md b/_overviews/scala3-book/types-inferred.md index d56bafb629..89b92996cd 100644 --- a/_overviews/scala3-book/types-inferred.md +++ b/_overviews/scala3-book/types-inferred.md @@ -2,7 +2,7 @@ title: Inferred Types type: section description: This section introduces and demonstrates inferred types in Scala 3 -num: 48 +num: 49 previous-page: types-introduction next-page: types-generics --- diff --git a/_overviews/scala3-book/types-intersection.md b/_overviews/scala3-book/types-intersection.md index 625f2bfa20..b9a9130530 100644 --- a/_overviews/scala3-book/types-intersection.md +++ b/_overviews/scala3-book/types-intersection.md @@ -2,7 +2,7 @@ title: Intersection Types type: section description: This section introduces and demonstrates intersection types in Scala 3. -num: 50 +num: 51 previous-page: types-generics next-page: types-union --- diff --git a/_overviews/scala3-book/types-introduction.md b/_overviews/scala3-book/types-introduction.md index 5719112cae..30c49a09dc 100644 --- a/_overviews/scala3-book/types-introduction.md +++ b/_overviews/scala3-book/types-introduction.md @@ -2,7 +2,7 @@ title: Types and the Type System type: chapter description: This chapter provides an introduction to Scala 3 types and the type system. -num: 47 +num: 48 previous-page: fp-summary next-page: types-inferred --- diff --git a/_overviews/scala3-book/types-opaque-types.md b/_overviews/scala3-book/types-opaque-types.md index 4911446f1d..fb9540033f 100644 --- a/_overviews/scala3-book/types-opaque-types.md +++ b/_overviews/scala3-book/types-opaque-types.md @@ -2,7 +2,7 @@ title: Opaque Types type: section description: This section introduces and demonstrates opaque types in Scala 3. -num: 54 +num: 55 previous-page: types-variance next-page: types-structural --- diff --git a/_overviews/scala3-book/types-others.md b/_overviews/scala3-book/types-others.md index cb87cccf2e..8500ab7028 100644 --- a/_overviews/scala3-book/types-others.md +++ b/_overviews/scala3-book/types-others.md @@ -2,7 +2,7 @@ title: Other Types type: section description: This section mentions other advanced types in Scala 3. -num: 57 +num: 58 previous-page: types-dependent-function next-page: ca-contextual-abstractions-intro --- diff --git a/_overviews/scala3-book/types-structural.md b/_overviews/scala3-book/types-structural.md index 8ae1d57d93..436a384921 100644 --- a/_overviews/scala3-book/types-structural.md +++ b/_overviews/scala3-book/types-structural.md @@ -2,7 +2,7 @@ title: Structural Types type: section description: This section introduces and demonstrates structural types in Scala 3. -num: 55 +num: 56 previous-page: types-opaque-types next-page: types-dependent-function --- diff --git a/_overviews/scala3-book/types-type-classes.md b/_overviews/scala3-book/types-type-classes.md index f0391f3806..39c915d057 100644 --- a/_overviews/scala3-book/types-type-classes.md +++ b/_overviews/scala3-book/types-type-classes.md @@ -2,7 +2,7 @@ title: Type Classes type: section description: This section introduces type classes in Scala 3. -num: 60 +num: 61 previous-page: ca-given-using-clauses next-page: ca-context-bounds --- diff --git a/_overviews/scala3-book/types-union.md b/_overviews/scala3-book/types-union.md index 30df27d05c..47a177c7c1 100644 --- a/_overviews/scala3-book/types-union.md +++ b/_overviews/scala3-book/types-union.md @@ -2,7 +2,7 @@ title: Union Types type: section description: This section introduces and demonstrates union types in Scala 3. -num: 51 +num: 52 previous-page: types-intersection next-page: types-adts-gadts --- diff --git a/_overviews/scala3-book/types-variance.md b/_overviews/scala3-book/types-variance.md index 84cba7d658..05d7bd11f9 100644 --- a/_overviews/scala3-book/types-variance.md +++ b/_overviews/scala3-book/types-variance.md @@ -2,7 +2,7 @@ title: Variance type: section description: This section introduces and demonstrates variance in Scala 3. -num: 53 +num: 54 previous-page: types-adts-gadts next-page: types-opaque-types ---