From e324add0d1a4d29e953e3f648dcc212289aff2f0 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Fri, 9 Apr 2021 07:16:00 +0200 Subject: [PATCH 1/8] [doc] improve strong typing sentence --- _overviews/scala3-book/scala-features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_overviews/scala3-book/scala-features.md b/_overviews/scala3-book/scala-features.md index 377498f951..56755942ff 100644 --- a/_overviews/scala3-book/scala-features.md +++ b/_overviews/scala3-book/scala-features.md @@ -136,7 +136,7 @@ Because Scala is considered to be a [strong, statically-typed language](https:// - Method type declarations tell readers what the method does, and help serve as documentation - Types make your code easier to maintain - Scalability: types help ensure correctness across arbitrarily large applications and development teams -- Strong types enable Scala features like implicits (TODO: I need help on this wording and description) +- Strong typing enables features like [contextual abstraction](https://dotty.epfl.ch/docs/reference/contextual/motivation.html) where the compiler kind of writes code for you based on type definitions and a given context. {% comment %} In that list: From 15d8daa9f1e37a988086803fbd0e0533efb008bd Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Fri, 9 Apr 2021 07:29:55 +0200 Subject: [PATCH 2/8] [doc] use site.scala3ref for the link --- _overviews/scala3-book/scala-features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_overviews/scala3-book/scala-features.md b/_overviews/scala3-book/scala-features.md index 56755942ff..a599955b17 100644 --- a/_overviews/scala3-book/scala-features.md +++ b/_overviews/scala3-book/scala-features.md @@ -136,7 +136,7 @@ Because Scala is considered to be a [strong, statically-typed language](https:// - Method type declarations tell readers what the method does, and help serve as documentation - Types make your code easier to maintain - Scalability: types help ensure correctness across arbitrarily large applications and development teams -- Strong typing enables features like [contextual abstraction](https://dotty.epfl.ch/docs/reference/contextual/motivation.html) where the compiler kind of writes code for you based on type definitions and a given context. +- Strong typing enables features like [contextual abstraction]({{ site.scala3ref }}/contextual/motivation.html) where the compiler kind of writes code for you based on type definitions and a given context. {% comment %} In that list: From a652ef4c67f0ab463d907db2df94e39248d1f7d5 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Fri, 9 Apr 2021 07:31:24 +0200 Subject: [PATCH 3/8] [doc] fix typo collections classes --- _overviews/scala3-book/scala-features.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_overviews/scala3-book/scala-features.md b/_overviews/scala3-book/scala-features.md index a599955b17..82e9d9a47a 100644 --- a/_overviews/scala3-book/scala-features.md +++ b/_overviews/scala3-book/scala-features.md @@ -202,8 +202,8 @@ Scala is a functional programming (FP) language, meaning: - 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 collections classes in the standard library -- Those collections classes come with dozens of functional methods: they don’t mutate the collection, but instead return an updated copy of the data +- 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 ### A pure OOP language From ee45e43251ae5957067cb0aacc70fa71ebc2fde9 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Fri, 9 Apr 2021 07:38:16 +0200 Subject: [PATCH 4/8] [doc] typo and comments --- _overviews/scala3-book/scala-features.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/_overviews/scala3-book/scala-features.md b/_overviews/scala3-book/scala-features.md index 82e9d9a47a..3a77f0d8b2 100644 --- a/_overviews/scala3-book/scala-features.md +++ b/_overviews/scala3-book/scala-features.md @@ -209,14 +209,16 @@ Scala is a functional programming (FP) language, meaning: ### A pure OOP language Scala is a _pure_ object-oriented programming (OOP) language. -Every variable is an object, and every “operator” is a method. +Every variable is an object and every “operator” is a method. 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. {% comment %} -Add the “types hierarchy” image here? +- AnyRef above is wrong in case of strict null checking, no? On the other hand, maybe too much information to state this here +- probably not worth to mention (too advanced at this point) there is AnyKind +- Add the “types hierarchy” image here? {% endcomment %} @@ -226,7 +228,7 @@ Add the “types hierarchy” image here? NOTE: This text in the first line comes from this slide: https://twitter.com/alexelcu/status/996408359514525696 {% endcomment %} -The essence of Scala is the fusion of functional programming and object-oriented programming in a typed settings: +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 From 6b5fac911bd666d8395cda31d5d32e72328d78e6 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Fri, 9 Apr 2021 07:47:59 +0200 Subject: [PATCH 5/8] [doc] @alpha is now called @targetName --- _overviews/scala3-book/scala-features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_overviews/scala3-book/scala-features.md b/_overviews/scala3-book/scala-features.md index 3a77f0d8b2..565749696a 100644 --- a/_overviews/scala3-book/scala-features.md +++ b/_overviews/scala3-book/scala-features.md @@ -332,7 +332,7 @@ At a “sea level” view of the details---i.e., the language features programme - 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 `@alpha` method annotation defines an alternate name for the method, improving Java interoperability, and letting you provide aliases for symbolic operators + - The `@targetName` 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]. From ff17b9b4c702abd2ae9a7a7ff77f1258cb3fe440 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Fri, 9 Apr 2021 07:50:26 +0200 Subject: [PATCH 6/8] [doc] link @targetName --- _overviews/scala3-book/scala-features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_overviews/scala3-book/scala-features.md b/_overviews/scala3-book/scala-features.md index 565749696a..5cdb5f5597 100644 --- a/_overviews/scala3-book/scala-features.md +++ b/_overviews/scala3-book/scala-features.md @@ -332,7 +332,7 @@ At a “sea level” view of the details---i.e., the language features programme - 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` method annotation defines an alternate name for the method, improving Java interoperability, and letting you provide aliases for symbolic operators + - 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]. From 018a86156766d22cb1fed7b0dc4a1a4387071c02 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Sun, 11 Apr 2021 20:38:42 +0200 Subject: [PATCH 7/8] [doc] put more focus on what a user does not have to do due to strong typing ...in combination with type inference --- _overviews/scala3-book/scala-features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_overviews/scala3-book/scala-features.md b/_overviews/scala3-book/scala-features.md index 5cdb5f5597..8425dcb0b2 100644 --- a/_overviews/scala3-book/scala-features.md +++ b/_overviews/scala3-book/scala-features.md @@ -136,7 +136,7 @@ Because Scala is considered to be a [strong, statically-typed language](https:// - Method type declarations tell readers what the method does, and help serve as documentation - Types make your code easier to maintain - Scalability: types help ensure correctness across arbitrarily large applications and development teams -- Strong typing enables features like [contextual abstraction]({{ site.scala3ref }}/contextual/motivation.html) where the compiler kind of writes code for you based on type definitions and a given context. +- Strong typing in combination with excellent inference enables mechanisms like [contextual abstraction]({{ site.scala3ref }}/contextual/motivation.html) that allows you to omit boilerplate code which can be inferred by the compiler based on type definitions and a given context (e.g. method arguments for implicit parameters). {% comment %} In that list: From 2549abff120cebdd3c8178f567994a72efe59937 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Mon, 12 Apr 2021 10:21:32 +0200 Subject: [PATCH 8/8] Update _overviews/scala3-book/scala-features.md Co-authored-by: Jonathan --- _overviews/scala3-book/scala-features.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/_overviews/scala3-book/scala-features.md b/_overviews/scala3-book/scala-features.md index 8425dcb0b2..1df980d863 100644 --- a/_overviews/scala3-book/scala-features.md +++ b/_overviews/scala3-book/scala-features.md @@ -136,7 +136,7 @@ Because Scala is considered to be a [strong, statically-typed language](https:// - Method type declarations tell readers what the method does, and help serve as documentation - Types make your code easier to maintain - Scalability: 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/motivation.html) that allows you to omit boilerplate code which can be inferred by the compiler based on type definitions and a given context (e.g. method arguments for implicit parameters). +- Strong typing in combination with excellent inference enables mechanisms like [contextual abstraction]({{ site.scala3ref }}/contextual/motivation.html) 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 (e.g. method arguments for implicit parameters). {% comment %} In that list: @@ -502,4 +502,3 @@ As this page shows, Scala has many terrific programming language features at a h -