From e767bbdbe74fd151b1f5be2143e560eecaa4b195 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 12:53:00 +0100 Subject: [PATCH 01/48] Add colon before list --- _getting-started/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_getting-started/index.md b/_getting-started/index.md index 30a62817a4..a4e0b0a3d7 100644 --- a/_getting-started/index.md +++ b/_getting-started/index.md @@ -8,7 +8,7 @@ includeTOC: true redirect_from: "/getting-started.html" --- -
There are two main ways people prefer to work in Scala.
+
There are two main ways people prefer to work in Scala:
  1. Using an IDE.
  2. From 212dca74f5aecfb266c44c2991708c7ed7aa6e5f Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 12:53:46 +0100 Subject: [PATCH 02/48] Change ordered list to unordered list as items do not represent a sequence or hierarchy --- _getting-started/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_getting-started/index.md b/_getting-started/index.md index a4e0b0a3d7..dd040da7d5 100644 --- a/_getting-started/index.md +++ b/_getting-started/index.md @@ -10,10 +10,10 @@ redirect_from: "/getting-started.html"
    There are two main ways people prefer to work in Scala:
    -
      +
      • Using an IDE.
      • Using the command line.
      • -
    + The following tutorials will walk you through the set up process for either way From e52b959aa44b9c3e6cb3dfe87bec7bbad682fd80 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 12:54:16 +0100 Subject: [PATCH 03/48] Change 'either' to 'whichever' --- _getting-started/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_getting-started/index.md b/_getting-started/index.md index dd040da7d5..1d7dbe5b20 100644 --- a/_getting-started/index.md +++ b/_getting-started/index.md @@ -16,7 +16,7 @@ redirect_from: "/getting-started.html" -The following tutorials will walk you through the set up process for either way +The following tutorials will walk you through the set up process for whichever way you prefer. However, if you just want to jump directly into Scala without installing anything, skip the guides on this page and check out: From 85af57bc051d4c5500ec8cb91b5b38a336545bdc Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 12:54:54 +0100 Subject: [PATCH 04/48] Capitalise first letter of item in a list --- _getting-started/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_getting-started/index.md b/_getting-started/index.md index 1d7dbe5b20..c2949b8fa1 100644 --- a/_getting-started/index.md +++ b/_getting-started/index.md @@ -22,7 +22,7 @@ you prefer. However, if you just want to jump directly into Scala without installing anything, skip the guides on this page and check out: From 702e32f2a80fbb07ff17ceee4330cdb9f4ba58f2 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 12:56:53 +0100 Subject: [PATCH 05/48] Add 'by' to clarifymeaning --- _getting-started/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_getting-started/index.md b/_getting-started/index.md index c2949b8fa1..52a87146c3 100644 --- a/_getting-started/index.md +++ b/_getting-started/index.md @@ -43,7 +43,7 @@ unit tests! ### If you prefer working on the command line... If you prefer using a text editor like emacs, Vim, Atom, or Sublime Text, then -the best way to compile, test, and run Scala code is using _sbt_, Scala's build +the best way to compile, test, and run Scala code is by using _sbt_, Scala's build tool. * [Getting Started with Scala and sbt on the Command Line](/getting-started/sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html) From 1d8fe41ccce6c789baf13cca9c095d353d3b6533 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 12:57:35 +0100 Subject: [PATCH 06/48] Add colon before a list --- _getting-started/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_getting-started/index.md b/_getting-started/index.md index 52a87146c3..df621e46fb 100644 --- a/_getting-started/index.md +++ b/_getting-started/index.md @@ -55,7 +55,7 @@ the rest, so it's as easy as possible for someone else to compile and run your Scala project. --> ## Next Steps -Once you've finished these tutorials, check out +Once you've finished these tutorials, check out: * [The Tour of Scala](/tour/tour-of-scala.html) for bite-sized introductions to Scala's features. * [The Scala Book](/overviews/scala-book/introduction.html), which provides a set of short lessons introducing Scala’s main features. From 7f4efb3458c8c022a1d8cdb50993167234c105e4 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 13:09:07 +0100 Subject: [PATCH 07/48] Add missing word, and add a comma and a 'for' for clarity --- _getting-started/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_getting-started/index.md b/_getting-started/index.md index df621e46fb..6e198516f8 100644 --- a/_getting-started/index.md +++ b/_getting-started/index.md @@ -63,4 +63,4 @@ Once you've finished these tutorials, check out: * [Our list of some popular Scala books](/books.html). ## Getting Help -There are a multitude of mailing lists and real-time chat channels in case you want to quickly connect with other Scala users. Check out our [community](https://scala-lang.org/community/) page a list of these resources and where to reach out for help. +There are a multitude of mailing lists and real-time chat channels in case you want to quickly connect with other Scala users. Check out our [community](https://scala-lang.org/community/) page for a list of these resources, and for where to reach out for help. From af2b2e3890689156bed4181cd35d1ffcff2d13a7 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 13:12:43 +0100 Subject: [PATCH 08/48] Change html lists to markdown for consistency with other lists --- _getting-started/index.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/_getting-started/index.md b/_getting-started/index.md index 6e198516f8..f5741b67a6 100644 --- a/_getting-started/index.md +++ b/_getting-started/index.md @@ -8,23 +8,18 @@ includeTOC: true redirect_from: "/getting-started.html" --- -
    There are two main ways people prefer to work in Scala:
    - -
      -
    • Using an IDE.
    • -
    • Using the command line.
    • -
    +There are __two__ main ways people prefer to work in Scala: +* Using an IDE. +* Using the command line. The following tutorials will walk you through the set up process for whichever way you prefer. However, if you just want to jump directly into Scala without installing anything, skip the guides on this page and check out: - +* [Our interactive introduction to Scala on scala-exercises.com](https://www.scala-exercises.org/scala_tutorial/terms_and_types), or +* [Scastie](https://scastie.scala-lang.org/), Scala in the browser, with access to all Scala compilers and all published libraries! ## Setting up and getting started with Scala From 629075acba81eb1424b2d65f263cebdce3ce404b Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 13:13:57 +0100 Subject: [PATCH 09/48] Change 'set up' verb to 'setup' adjective --- _getting-started/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_getting-started/index.md b/_getting-started/index.md index f5741b67a6..77147fc08c 100644 --- a/_getting-started/index.md +++ b/_getting-started/index.md @@ -13,7 +13,7 @@ There are __two__ main ways people prefer to work in Scala: * Using an IDE. * Using the command line. -The following tutorials will walk you through the set up process for whichever way +The following tutorials will walk you through the setup process for whichever way you prefer. However, if you just want to jump directly into Scala without installing anything, skip the guides on this page and check out: From 761ca7db2c4f98dbf2c39a27e943554e3f950788 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 13:54:48 +0100 Subject: [PATCH 10/48] Change 'smoothly' integrates to 'seamlessly' integrates, as 'seamlessly' is more commonly used to express integration. --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index cef8e9dab1..b59edb5f1b 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -21,7 +21,7 @@ you want that, consider obtaining [a book](/books.html) or consulting [other resources](/learn.html). ## What is Scala? -Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages. +Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It seamlessly integrates features of object-oriented and functional languages. ## Scala is object-oriented ## Scala is a pure object-oriented language in the sense that [every value is an object](unified-types.html). Types and behavior of objects are described by [classes](classes.html) and [traits](traits.html). Classes are extended by subclassing and a flexible [mixin-based composition](mixin-class-composition.html) mechanism as a clean replacement for multiple inheritance. From b47dd26a7bec4150d393dbd5a6800737f08fa3bf Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 14:09:00 +0100 Subject: [PATCH 11/48] Flesh out the word 'that', to provide more clarity --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index b59edb5f1b..7ec4c4b3fd 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -17,7 +17,7 @@ This tour contains bite-sized introductions to the most frequently used features of Scala. It is intended for newcomers to the language. This is just a brief tour, not a full language tutorial. If -you want that, consider obtaining [a book](/books.html) or consulting +you want a more detailed guide, consider obtaining [a book](/books.html) or consulting [other resources](/learn.html). ## What is Scala? From 8b1fdcea5b44e1038881cb8903ef6b3583796e4a Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 14:14:51 +0100 Subject: [PATCH 12/48] Change 'behavior' to 'behaviors' for clarity, as it may seem like all objects have one behaviour, instead of each object having its own behaviour --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index 7ec4c4b3fd..5bfac9c182 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -24,7 +24,7 @@ you want a more detailed guide, consider obtaining [a book](/books.html) or cons Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It seamlessly integrates features of object-oriented and functional languages. ## Scala is object-oriented ## -Scala is a pure object-oriented language in the sense that [every value is an object](unified-types.html). Types and behavior of objects are described by [classes](classes.html) and [traits](traits.html). Classes are extended by subclassing and a flexible [mixin-based composition](mixin-class-composition.html) mechanism as a clean replacement for multiple inheritance. +Scala is a pure object-oriented language in the sense that [every value is an object](unified-types.html). Types and behaviors of objects are described by [classes](classes.html) and [traits](traits.html). Classes are extended by subclassing and a flexible [mixin-based composition](mixin-class-composition.html) mechanism as a clean replacement for multiple inheritance. ## Scala is functional ## Scala is also a functional language in the sense that [every function is a value](unified-types.html). Scala provides a [lightweight syntax](basics.html#functions) for defining anonymous functions, it supports [higher-order functions](higher-order-functions.html), it allows functions to be [nested](nested-functions.html), and supports [currying](multiple-parameter-lists.html). Scala's [case classes](case-classes.html) and its built-in support for [pattern matching](pattern-matching.html) model algebraic types used in many functional programming languages. [Singleton objects](singleton-objects.html) provide a convenient way to group functions that aren't members of a class. From 9d9a2b5c8b04c4ced2e01576582d23244135ecf7 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 14:24:00 +0100 Subject: [PATCH 13/48] Change sentence slightly to clarify that subclassing and mixins are two separate options --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index 5bfac9c182..46c77ab7f1 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -24,7 +24,7 @@ you want a more detailed guide, consider obtaining [a book](/books.html) or cons Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It seamlessly integrates features of object-oriented and functional languages. ## Scala is object-oriented ## -Scala is a pure object-oriented language in the sense that [every value is an object](unified-types.html). Types and behaviors of objects are described by [classes](classes.html) and [traits](traits.html). Classes are extended by subclassing and a flexible [mixin-based composition](mixin-class-composition.html) mechanism as a clean replacement for multiple inheritance. +Scala is a pure object-oriented language in the sense that [every value is an object](unified-types.html). Types and behaviors of objects are described by [classes](classes.html) and [traits](traits.html). Classes can be extended by subclassing, and by using a flexible [mixin-based composition](mixin-class-composition.html) mechanism as a clean replacement for multiple inheritance. ## Scala is functional ## Scala is also a functional language in the sense that [every function is a value](unified-types.html). Scala provides a [lightweight syntax](basics.html#functions) for defining anonymous functions, it supports [higher-order functions](higher-order-functions.html), it allows functions to be [nested](nested-functions.html), and supports [currying](multiple-parameter-lists.html). Scala's [case classes](case-classes.html) and its built-in support for [pattern matching](pattern-matching.html) model algebraic types used in many functional programming languages. [Singleton objects](singleton-objects.html) provide a convenient way to group functions that aren't members of a class. From 1a4956b94493aab6965a1acbf52fb78679e7b37e Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 14:26:13 +0100 Subject: [PATCH 14/48] Add it for consistency with the rest of the list --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index 46c77ab7f1..3e3a9fd4ba 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -27,7 +27,7 @@ Scala is a modern multi-paradigm programming language designed to express common Scala is a pure object-oriented language in the sense that [every value is an object](unified-types.html). Types and behaviors of objects are described by [classes](classes.html) and [traits](traits.html). Classes can be extended by subclassing, and by using a flexible [mixin-based composition](mixin-class-composition.html) mechanism as a clean replacement for multiple inheritance. ## Scala is functional ## -Scala is also a functional language in the sense that [every function is a value](unified-types.html). Scala provides a [lightweight syntax](basics.html#functions) for defining anonymous functions, it supports [higher-order functions](higher-order-functions.html), it allows functions to be [nested](nested-functions.html), and supports [currying](multiple-parameter-lists.html). Scala's [case classes](case-classes.html) and its built-in support for [pattern matching](pattern-matching.html) model algebraic types used in many functional programming languages. [Singleton objects](singleton-objects.html) provide a convenient way to group functions that aren't members of a class. +Scala is also a functional language in the sense that [every function is a value](unified-types.html). Scala provides a [lightweight syntax](basics.html#functions) for defining anonymous functions, it supports [higher-order functions](higher-order-functions.html), it allows functions to be [nested](nested-functions.html), and it supports [currying](multiple-parameter-lists.html). Scala's [case classes](case-classes.html) and its built-in support for [pattern matching](pattern-matching.html) model algebraic types used in many functional programming languages. [Singleton objects](singleton-objects.html) provide a convenient way to group functions that aren't members of a class. Furthermore, Scala's notion of pattern matching naturally extends to the [processing of XML data](https://github.com/scala/scala-xml/wiki/XML-Processing) with the help of [right-ignoring sequence patterns](regular-expression-patterns.html), by way of general extension via [extractor objects](extractor-objects.html). In this context, [for comprehensions](for-comprehensions.html) are useful for formulating queries. These features make Scala ideal for developing applications like web services. From 96711b4fd74b7990eba13d6a63ae3e1616534208 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 14:28:13 +0100 Subject: [PATCH 15/48] Add missing word --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index 3e3a9fd4ba..17d7c228e1 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -27,7 +27,7 @@ Scala is a modern multi-paradigm programming language designed to express common Scala is a pure object-oriented language in the sense that [every value is an object](unified-types.html). Types and behaviors of objects are described by [classes](classes.html) and [traits](traits.html). Classes can be extended by subclassing, and by using a flexible [mixin-based composition](mixin-class-composition.html) mechanism as a clean replacement for multiple inheritance. ## Scala is functional ## -Scala is also a functional language in the sense that [every function is a value](unified-types.html). Scala provides a [lightweight syntax](basics.html#functions) for defining anonymous functions, it supports [higher-order functions](higher-order-functions.html), it allows functions to be [nested](nested-functions.html), and it supports [currying](multiple-parameter-lists.html). Scala's [case classes](case-classes.html) and its built-in support for [pattern matching](pattern-matching.html) model algebraic types used in many functional programming languages. [Singleton objects](singleton-objects.html) provide a convenient way to group functions that aren't members of a class. +Scala is also a functional language in the sense that [every function is a value](unified-types.html). Scala provides a [lightweight syntax](basics.html#functions) for defining anonymous functions, it supports [higher-order functions](higher-order-functions.html), it allows functions to be [nested](nested-functions.html), and it supports [currying](multiple-parameter-lists.html). Scala's [case classes](case-classes.html) and its built-in support for [pattern matching](pattern-matching.html) model algebraic types are used in many functional programming languages. [Singleton objects](singleton-objects.html) provide a convenient way to group functions that aren't members of a class. Furthermore, Scala's notion of pattern matching naturally extends to the [processing of XML data](https://github.com/scala/scala-xml/wiki/XML-Processing) with the help of [right-ignoring sequence patterns](regular-expression-patterns.html), by way of general extension via [extractor objects](extractor-objects.html). In this context, [for comprehensions](for-comprehensions.html) are useful for formulating queries. These features make Scala ideal for developing applications like web services. From 46d0dafd3140b4d92a207bb70fc227190c6f051b Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 14:44:12 +0100 Subject: [PATCH 16/48] Capitalise first letter of items in a list --- _tour/tour-of-scala.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index 17d7c228e1..c8be5fecf2 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -34,14 +34,14 @@ Furthermore, Scala's notion of pattern matching naturally extends to the [proces ## Scala is statically typed ## Scala's expressive type system enforces, at compile-time, that abstractions are used in a safe and coherent manner. In particular, the type system supports: -* [generic classes](generic-classes.html) -* [variance annotations](variances.html) -* [upper](upper-type-bounds.html) and [lower](lower-type-bounds.html) type bounds, -* [inner classes](inner-classes.html) and [abstract type members](abstract-type-members.html) as object members -* [compound types](compound-types.html) -* [explicitly typed self references](self-types.html) -* [implicit parameters](implicit-parameters.html) and [conversions](implicit-conversions.html) -* [polymorphic methods](polymorphic-methods.html) +* [Generic classes](generic-classes.html) +* [Variance annotations](variances.html) +* [Upper](upper-type-bounds.html) and [lower](lower-type-bounds.html) type bounds, +* [Inner classes](inner-classes.html) and [abstract type members](abstract-type-members.html) as object members +* [Compound types](compound-types.html) +* [Explicitly typed self references](self-types.html) +* [Implicit parameters](implicit-parameters.html) and [conversions](implicit-conversions.html) +* [Polymorphic methods](polymorphic-methods.html) [Type inference](type-inference.html) means the user is not required to annotate code with redundant type information. In combination, these features provide a powerful basis for the safe reuse of programming abstractions and for the type-safe extension of software. From d2e90e020d0afb0893b4ad5d8f1ee7c3b69259a6 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 14:51:55 +0100 Subject: [PATCH 17/48] Change use of 'easy' and 'smoothly' to 'straightforward', as these two words may be an expert's subjective opinion --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index c8be5fecf2..a5ef1cf064 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -47,7 +47,7 @@ Scala's expressive type system enforces, at compile-time, that abstractions are ## Scala is extensible ## -In practice, the development of domain-specific applications often requires domain-specific language extensions. Scala provides a unique combination of language mechanisms that make it easy to smoothly add new language constructs in the form of libraries. +In practice, the development of domain-specific applications often requires domain-specific language extensions. Scala provides a unique combination of language mechanisms that make it straightforward to add new language constructs in the form of libraries. In many cases, this can be done without using meta-programming facilities such as macros. For example, From 06ab7420481922a23e57dfc07ca79de5302303b7 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 14:54:16 +0100 Subject: [PATCH 18/48] Change 'smooth' to 'seamless' --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index a5ef1cf064..6ee4979a31 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -56,7 +56,7 @@ In many cases, this can be done without using meta-programming facilities such a ## Scala interoperates -Scala is designed to interoperate well with the popular Java Runtime Environment (JRE). In particular, the interaction with the mainstream object-oriented Java programming language is as smooth as possible. Newer Java features like SAMs, [lambdas](higher-order-functions.html), [annotations](annotations.html), and [generics](generic-classes.html) have direct analogues in Scala. +Scala is designed to interoperate well with the popular Java Runtime Environment (JRE). In particular, the interaction with the mainstream object-oriented Java programming language is as seamless as possible. Newer Java features like SAMs, [lambdas](higher-order-functions.html), [annotations](annotations.html), and [generics](generic-classes.html) have direct analogues in Scala. Those Scala features without Java analogues, such as [default](default-parameter-values.html) and [named parameters](named-arguments.html), compile as close to Java as they can reasonably come. Scala has the same compilation model (separate compilation, dynamic class loading) like Java and allows access to thousands of existing high-quality libraries. From 22b3f49a826338908da68fd910958c973a8b7f27 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 15:03:27 +0100 Subject: [PATCH 19/48] Change 'close' to 'closely', as 'close' relates to location in physical space. Add 'as reasonably possible' to have a shorter sentence while retaining same meaning. --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index 6ee4979a31..692a3e4e4d 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -58,7 +58,7 @@ In many cases, this can be done without using meta-programming facilities such a Scala is designed to interoperate well with the popular Java Runtime Environment (JRE). In particular, the interaction with the mainstream object-oriented Java programming language is as seamless as possible. Newer Java features like SAMs, [lambdas](higher-order-functions.html), [annotations](annotations.html), and [generics](generic-classes.html) have direct analogues in Scala. -Those Scala features without Java analogues, such as [default](default-parameter-values.html) and [named parameters](named-arguments.html), compile as close to Java as they can reasonably come. Scala has the same compilation model (separate compilation, dynamic class loading) like Java and allows access to thousands of existing high-quality libraries. +Those Scala features without Java analogues, such as [default](default-parameter-values.html) and [named parameters](named-arguments.html), compile as closely to Java as reasonably possible. Scala has the same compilation model (separate compilation, dynamic class loading) like Java and allows access to thousands of existing high-quality libraries. ## Enjoy the tour! From 875ce74455a633bc80636ae1fe422fd92eb80cb0 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 15:05:51 +0100 Subject: [PATCH 20/48] Change grammar; should be 'as' instead of 'with' --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index 692a3e4e4d..2c485ae98c 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -58,7 +58,7 @@ In many cases, this can be done without using meta-programming facilities such a Scala is designed to interoperate well with the popular Java Runtime Environment (JRE). In particular, the interaction with the mainstream object-oriented Java programming language is as seamless as possible. Newer Java features like SAMs, [lambdas](higher-order-functions.html), [annotations](annotations.html), and [generics](generic-classes.html) have direct analogues in Scala. -Those Scala features without Java analogues, such as [default](default-parameter-values.html) and [named parameters](named-arguments.html), compile as closely to Java as reasonably possible. Scala has the same compilation model (separate compilation, dynamic class loading) like Java and allows access to thousands of existing high-quality libraries. +Those Scala features without Java analogues, such as [default](default-parameter-values.html) and [named parameters](named-arguments.html), compile as closely to Java as reasonably possible. Scala has the same compilation model (separate compilation, dynamic class loading) as Java and allows access to thousands of existing high-quality libraries. ## Enjoy the tour! From 5892a23986e7df672e0fb4b04b9f72cb8f0316dd Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 15:11:44 +0100 Subject: [PATCH 21/48] Remove reference to contents menu to prevent information overload; there is a link to the next page within the sentence, and again directly below the sentence --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index 2c485ae98c..e6e83e06f6 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -62,4 +62,4 @@ Those Scala features without Java analogues, such as [default](default-parameter ## Enjoy the tour! -Please continue to the [next page](basics.html) in the Contents menu to read more. +Please continue to the [next page](basics.html) to read more. From 41d27294e85f47d00e6d6dcaafdc8ffc731eac11 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 15:14:01 +0100 Subject: [PATCH 22/48] Add a colon directly preceding a list --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index e6e83e06f6..fd69daa081 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -49,7 +49,7 @@ Scala's expressive type system enforces, at compile-time, that abstractions are In practice, the development of domain-specific applications often requires domain-specific language extensions. Scala provides a unique combination of language mechanisms that make it straightforward to add new language constructs in the form of libraries. -In many cases, this can be done without using meta-programming facilities such as macros. For example, +In many cases, this can be done without using meta-programming facilities such as macros. For example: * [Implicit classes](/overviews/core/implicit-classes.html) allow adding extension methods to existing types. * [String interpolation](/overviews/core/string-interpolation.html) is user-extensible with custom interpolators. From e38d98433e6489b200e2e441e0d54203be2c9f14 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 15:14:53 +0100 Subject: [PATCH 23/48] Remove unnecessary comma from list item --- _tour/tour-of-scala.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index fd69daa081..f9c1b9325a 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -36,7 +36,7 @@ Scala's expressive type system enforces, at compile-time, that abstractions are * [Generic classes](generic-classes.html) * [Variance annotations](variances.html) -* [Upper](upper-type-bounds.html) and [lower](lower-type-bounds.html) type bounds, +* [Upper](upper-type-bounds.html) and [lower](lower-type-bounds.html) type bounds * [Inner classes](inner-classes.html) and [abstract type members](abstract-type-members.html) as object members * [Compound types](compound-types.html) * [Explicitly typed self references](self-types.html) From 49911953aac6b02141ae9288327c9ce17416e236 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 16:29:18 +0100 Subject: [PATCH 24/48] Add missing word --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index cafcf3def7..d4ea72008c 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -10,7 +10,7 @@ previous-page: tour-of-scala redirect_from: "/tutorials/tour/basics.html" --- -In this page, we will cover basics of Scala. +In this page, we will cover the basics of Scala. ## Trying Scala in the Browser From e0ec662e3cff861ebcc07e44273a14f577f3f949 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 16:30:32 +0100 Subject: [PATCH 25/48] Add a colon before a list --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index d4ea72008c..57565b857a 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -14,7 +14,7 @@ In this page, we will cover the basics of Scala. ## Trying Scala in the Browser -You can run Scala in your browser with ScalaFiddle. +You can run Scala in your browser with ScalaFiddle: 1. Go to [https://scalafiddle.io](https://scalafiddle.io). 2. Paste `println("Hello, world!")` in the left pane. From ddf423d3eacd3c768530232dd3d7d8d1dbf4e634 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 16:34:44 +0100 Subject: [PATCH 26/48] Change words to increase clarity --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index 57565b857a..ae16510759 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -18,7 +18,7 @@ You can run Scala in your browser with ScalaFiddle: 1. Go to [https://scalafiddle.io](https://scalafiddle.io). 2. Paste `println("Hello, world!")` in the left pane. -3. Hit "Run" button. Output appears in the right pane. +3. Click __Run__. The output appears in the right pane. This is an easy, zero-setup way to experiment with pieces of Scala code. From 627a5528aac26493da1df172cab2a76af8bf6e8a Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 16:49:43 +0100 Subject: [PATCH 27/48] Rearrange wording to increase clarity. Italicise 'ScalaFiddle' --- _tour/basics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_tour/basics.md b/_tour/basics.md index ae16510759..a861306c32 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -22,8 +22,8 @@ You can run Scala in your browser with ScalaFiddle: This is an easy, zero-setup way to experiment with pieces of Scala code. -Many of the code examples in this documentation are also integrated with ScalaFiddle, so you -can directly experiment with them simply by clicking the Run-button. +_ScalaFiddle_ is integrated with some of the code examples in this documentation; if you see a __Run__ button in a code example below, click it to directly experiment with the code. + ## Expressions From 0f9e44cd654a6cf8d6b00b5cba58c18993813c52 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 16:54:59 +0100 Subject: [PATCH 28/48] Italicise 'ScalaFiddle'. Reorganise sentences to group similar information together --- _tour/basics.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/_tour/basics.md b/_tour/basics.md index a861306c32..e219ab9d44 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -14,14 +14,12 @@ In this page, we will cover the basics of Scala. ## Trying Scala in the Browser -You can run Scala in your browser with ScalaFiddle: +You can run Scala in your browser with _ScalaFiddle_. This is an easy, zero-setup way to experiment with pieces of Scala code: 1. Go to [https://scalafiddle.io](https://scalafiddle.io). 2. Paste `println("Hello, world!")` in the left pane. 3. Click __Run__. The output appears in the right pane. -This is an easy, zero-setup way to experiment with pieces of Scala code. - _ScalaFiddle_ is integrated with some of the code examples in this documentation; if you see a __Run__ button in a code example below, click it to directly experiment with the code. From b03bf63bad7e1aa3760526bdf73069299a877da6 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 17:13:55 +0100 Subject: [PATCH 29/48] Add a colon when introducing a code example --- _tour/basics.md | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/_tour/basics.md b/_tour/basics.md index e219ab9d44..570e8195e1 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -22,14 +22,13 @@ You can run Scala in your browser with _ScalaFiddle_. This is an easy, zero-setu _ScalaFiddle_ is integrated with some of the code examples in this documentation; if you see a __Run__ button in a code example below, click it to directly experiment with the code. - ## Expressions -Expressions are computable statements. +Expressions are computable statements: ``` 1 + 1 ``` -You can output results of expressions using `println`. +You can output results of expressions using `println`: {% scalafiddle %} ```tut @@ -42,7 +41,7 @@ println("Hello," + " world!") // Hello, world! ### Values -You can name results of expressions with the `val` keyword. +You can name results of expressions with the `val` keyword: ```tut val x = 1 + 1 @@ -52,7 +51,7 @@ println(x) // 2 Named results, such as `x` here, are called values. Referencing a value does not re-compute it. -Values cannot be re-assigned. +Values cannot be re-assigned: ```tut:fail x = 3 // This does not compile. @@ -72,7 +71,7 @@ Variables are like values, except you can re-assign them. You can define a varia ```tut var x = 1 + 1 -x = 3 // This compiles because "x" is declared with the "var" keyword. +x = 3 // This compiles because "x" is declared with the "var" keyword: println(x * x) // 9 ``` @@ -87,7 +86,7 @@ var x: Int = 1 + 1 You can combine expressions by surrounding them with `{}`. We call this a block. -The result of the last expression in the block is the result of the overall block, too. +The result of the last expression in the block is the result of the overall block, too: ```tut println({ @@ -108,7 +107,7 @@ You can define an anonymous function (i.e. no name) that returns a given integer On the left of `=>` is a list of parameters. On the right is an expression involving the parameters. -You can also name functions. +You can also name functions: {% scalafiddle %} ```tut @@ -117,7 +116,7 @@ println(addOne(1)) // 2 ``` {% endscalafiddle %} -Functions may take multiple parameters. +Functions may take multiple parameters: {% scalafiddle %} ```tut @@ -126,7 +125,7 @@ println(add(1, 2)) // 3 ``` {% endscalafiddle %} -Or it can take no parameters. +Or it can take no parameters: ```tut val getTheAnswer = () => 42 @@ -137,7 +136,7 @@ println(getTheAnswer()) // 42 Methods look and behave very similar to functions, but there are a few key differences between them. -Methods are defined with the `def` keyword. `def` is followed by a name, parameter lists, a return type, and a body. +Methods are defined with the `def` keyword. `def` is followed by a name, parameter lists, a return type, and a body: {% scalafiddle %} ```tut @@ -148,7 +147,7 @@ println(add(1, 2)) // 3 Notice how the return type is declared _after_ the parameter list and a colon `: Int`. -Methods can take multiple parameter lists. +Methods can take multiple parameter lists: {% scalafiddle %} ```tut @@ -157,7 +156,7 @@ println(addThenMultiply(1, 2)(3)) // 9 ``` {% endscalafiddle %} -Or no parameter lists at all. +Or no parameter lists at all: ```tut def name: String = System.getProperty("user.name") @@ -166,7 +165,7 @@ println("Hello, " + name + "!") There are some other differences, but for now, you can think of them as something similar to functions. -Methods can have multi-line expressions as well. +Methods can have multi-line expressions as well: {% scalafiddle %} ```tut @@ -182,7 +181,7 @@ The last expression in the body is the method's return value. (Scala does have a ## Classes -You can define classes with the `class` keyword followed by its name and constructor parameters. +You can define classes with the `class` keyword followed by its name and constructor parameters: ```tut class Greeter(prefix: String, suffix: String) { @@ -192,7 +191,7 @@ class Greeter(prefix: String, suffix: String) { ``` The return type of the method `greet` is `Unit`, which says there's nothing meaningful to return. It's used similarly to `void` in Java and C. (A difference is that because every Scala expression must have some value, there is actually a singleton value of type Unit, written (). It carries no information.) -You can make an instance of a class with the `new` keyword. +You can make an instance of a class with the `new` keyword: ```tut val greeter = new Greeter("Hello, ", "!") @@ -203,13 +202,13 @@ We will cover classes in depth [later](classes.html). ## Case Classes -Scala has a special type of class called a "case" class. By default, case classes are immutable and compared by value. You can define case classes with the `case class` keywords. +Scala has a special type of class called a "case" class. By default, case classes are immutable and compared by value. You can define case classes with the `case class` keywords: ```tut case class Point(x: Int, y: Int) ``` -You can instantiate case classes without `new` keyword. +You can instantiate case classes without `new` keyword: ```tut val point = Point(1, 2) @@ -217,7 +216,7 @@ val anotherPoint = Point(1, 2) val yetAnotherPoint = Point(2, 2) ``` -And they are compared by value. +And they are compared by value: ```tut if (point == anotherPoint) { @@ -239,7 +238,7 @@ There is a lot more to case classes that we'd like to introduce, and we are conv Objects are single instances of their own definitions. You can think of them as singletons of their own classes. -You can define objects with the `object` keyword. +You can define objects with the `object` keyword: ```tut object IdFactory { @@ -251,7 +250,7 @@ object IdFactory { } ``` -You can access an object by referring to its name. +You can access an object by referring to its name: ```tut val newId: Int = IdFactory.create() @@ -266,7 +265,7 @@ We will cover objects in depth [later](singleton-objects.html). Traits are types containing certain fields and methods. Multiple traits can be combined. -You can define traits with `trait` keyword. +You can define traits with `trait` keyword: ```tut trait Greeter { @@ -274,7 +273,7 @@ trait Greeter { } ``` -Traits can also have default implementations. +Traits can also have default implementations: {% scalafiddle %} ```tut @@ -284,7 +283,7 @@ trait Greeter { } ``` -You can extend traits with the `extends` keyword and override an implementation with the `override` keyword. +You can extend traits with the `extends` keyword and override an implementation with the `override` keyword: ```tut class DefaultGreeter extends Greeter From 7d663921230ed962a04803bd5895c4fff86ced38 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 17:20:46 +0100 Subject: [PATCH 30/48] Add words for clarity and consistency --- _tour/basics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_tour/basics.md b/_tour/basics.md index 570e8195e1..8a7460d2d2 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -28,7 +28,7 @@ Expressions are computable statements: ``` 1 + 1 ``` -You can output results of expressions using `println`: +You can output the results of expressions using `println`: {% scalafiddle %} ```tut @@ -41,7 +41,7 @@ println("Hello," + " world!") // Hello, world! ### Values -You can name results of expressions with the `val` keyword: +You can name the results of expressions using the `val` keyword: ```tut val x = 1 + 1 From 26e491bc512e9c453de112043e8cea9412f8a7d6 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 17:38:52 +0100 Subject: [PATCH 31/48] Add more clarity around type inference --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index 8a7460d2d2..3d23df3ad2 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -57,7 +57,7 @@ Values cannot be re-assigned: x = 3 // This does not compile. ``` -Types of values can be inferred, but you can also explicitly state the type, like this: +The type of a value can be omitted, and inferred by [type inference](https://docs.scala-lang.org/tour/type-inference.html), or it can be explicitly stated: ```tut val x: Int = 1 + 1 From 8e1428ae74f5ad2dcc0738e8573583dde0a37709 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 17:43:37 +0100 Subject: [PATCH 32/48] Add more clarity around type inference --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index 3d23df3ad2..968648c143 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -75,7 +75,7 @@ x = 3 // This compiles because "x" is declared with the "var" keyword: println(x * x) // 9 ``` -As with values, you can explicitly state the type if you want: +As with values, the type of a variable can be omitted, and inferred by [type inference](https://docs.scala-lang.org/tour/type-inference.html), or it can be explicitly stated: ```tut var x: Int = 1 + 1 From c692abcd366461fc6ebb2e16134c495d269c7ba8 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 17:48:17 +0100 Subject: [PATCH 33/48] Update description of scala functions. --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index 968648c143..adfc41a22c 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -97,7 +97,7 @@ println({ ## Functions -Functions are expressions that take parameters. +Functions are expressions that have parameters, and take arguments. You can define an anonymous function (i.e. no name) that returns a given integer plus one: From 2567d1c7cae971d2f5ddad87c2bc0d7599734613 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 17:51:58 +0100 Subject: [PATCH 34/48] Add clarity to anonymous function description --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index adfc41a22c..f7fd52a4ec 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -99,7 +99,7 @@ println({ Functions are expressions that have parameters, and take arguments. -You can define an anonymous function (i.e. no name) that returns a given integer plus one: +You can define an anonymous function (i.e., a function that has no name) that returns a given integer plus one: ```tut (x: Int) => x + 1 From 69026085b9d2035427ab206db3ffb71765f8c002 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 18:38:20 +0100 Subject: [PATCH 35/48] Change 'parameter' to 'argument' --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index f7fd52a4ec..65de8fbd9d 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -116,7 +116,7 @@ println(addOne(1)) // 2 ``` {% endscalafiddle %} -Functions may take multiple parameters: +Functions may take multiple arguments: {% scalafiddle %} ```tut From 25bfca3ca31de059d7de1ebd71d67ba72705b497 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 18:38:47 +0100 Subject: [PATCH 36/48] Change 'parameter' to 'argument' --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index 65de8fbd9d..f5e22bb4ac 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -125,7 +125,7 @@ println(add(1, 2)) // 3 ``` {% endscalafiddle %} -Or it can take no parameters: +Or it can take no arguments: ```tut val getTheAnswer = () => 42 From 121e24e151e5964c698320d3c1a8fcaa3de096a3 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 18:42:12 +0100 Subject: [PATCH 37/48] Add parenthesis around 's' to clarify that multiple parameter lists are not a rule --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index f5e22bb4ac..e02d45e37b 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -136,7 +136,7 @@ println(getTheAnswer()) // 42 Methods look and behave very similar to functions, but there are a few key differences between them. -Methods are defined with the `def` keyword. `def` is followed by a name, parameter lists, a return type, and a body: +Methods are defined with the `def` keyword. `def` is followed by a name, parameter list(s), a return type, and a body: {% scalafiddle %} ```tut From d5ace9ebd6c4a59f405057f9a68e1d32a40bb5e0 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 18:49:21 +0100 Subject: [PATCH 38/48] Remove redundancy of having the word 'colon' followed by the colon punctuation mark --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index e02d45e37b..f44ed3246a 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -145,7 +145,7 @@ println(add(1, 2)) // 3 ``` {% endscalafiddle %} -Notice how the return type is declared _after_ the parameter list and a colon `: Int`. +Notice how the return type is declared _after_ the parameter list and the `: Int`. Methods can take multiple parameter lists: From 3279cbfac5675c95d78b7b3335d7a669c744777e Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 18:59:14 +0100 Subject: [PATCH 39/48] Clarify the description of 'Unit' --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index f44ed3246a..a85bffdacb 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -189,7 +189,7 @@ class Greeter(prefix: String, suffix: String) { println(prefix + name + suffix) } ``` -The return type of the method `greet` is `Unit`, which says there's nothing meaningful to return. It's used similarly to `void` in Java and C. (A difference is that because every Scala expression must have some value, there is actually a singleton value of type Unit, written (). It carries no information.) +The return type of the method `greet` is `Unit`, which signifies that there's nothing meaningful to return. It is used similarly to `void` in Java and C. (A difference is that, because every Scala expression must have some value, there is actually a singleton value of type Unit, written (). It carries no information.) You can make an instance of a class with the `new` keyword: From 52e065bbe8f947569bcf6d047656b637d8878ddd Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 19:15:40 +0100 Subject: [PATCH 40/48] Flesh out the definition of case classes --- _tour/basics.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index a85bffdacb..aa8866fd57 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -202,7 +202,9 @@ We will cover classes in depth [later](classes.html). ## Case Classes -Scala has a special type of class called a "case" class. By default, case classes are immutable and compared by value. You can define case classes with the `case class` keywords: +Scala has a special type of class called a "case" class. By default, case classes are immutable, and they are compared by value (unlike classes, which are compared by reference). This makes them particularly useful for [pattern matching](https://docs.scala-lang.org/tour/pattern-matching.html#matching-on-case-classes). + +You can define case classes with the `case class` keywords: ```tut case class Point(x: Int, y: Int) From ba031822a1ac3ea7d56e320cd1cbc2f65a1e81b2 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 19:17:46 +0100 Subject: [PATCH 41/48] Add missing word --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index aa8866fd57..4b3b79eb0f 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -210,7 +210,7 @@ You can define case classes with the `case class` keywords: case class Point(x: Int, y: Int) ``` -You can instantiate case classes without `new` keyword: +You can instantiate case classes without the `new` keyword: ```tut val point = Point(1, 2) From 4c50787b6ddddf9d09e5ac3a5a1c9bb61bb1a71f Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 19:18:54 +0100 Subject: [PATCH 42/48] Add clarity to case class comparison --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index 4b3b79eb0f..feac50dd24 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -218,7 +218,7 @@ val anotherPoint = Point(1, 2) val yetAnotherPoint = Point(2, 2) ``` -And they are compared by value: +And case classes are compared by value, not by reference: ```tut if (point == anotherPoint) { From 1671d4ec867300f646b6a448d345e3d595341ebf Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 19:20:24 +0100 Subject: [PATCH 43/48] Add missing word --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index feac50dd24..0412458979 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -267,7 +267,7 @@ We will cover objects in depth [later](singleton-objects.html). Traits are types containing certain fields and methods. Multiple traits can be combined. -You can define traits with `trait` keyword: +You can define traits with the `trait` keyword: ```tut trait Greeter { From 48f1e8ff4c13cf4ed99699cae3305a72ef4d60dd Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 19:39:43 +0100 Subject: [PATCH 44/48] Flesh out the description of traits for clarity --- _tour/basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/basics.md b/_tour/basics.md index 0412458979..e27c079eb9 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -265,7 +265,7 @@ We will cover objects in depth [later](singleton-objects.html). ## Traits -Traits are types containing certain fields and methods. Multiple traits can be combined. +Traits are abstract data types containing certain fields and methods. In Scala inheritance, a class can not only inherit from a super class, but also mix in one or more traits. You can define traits with the `trait` keyword: From 675528b5bde69176daf583ea06acdf4dae8a57d9 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 19:46:08 +0100 Subject: [PATCH 45/48] Clarify the definition of a main method --- _tour/basics.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_tour/basics.md b/_tour/basics.md index e27c079eb9..bf6f43c6e1 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -310,11 +310,11 @@ We will cover traits in depth [later](traits.html). ## Main Method -The main method is an entry point of a program. The Java Virtual -Machine requires a main method to be named `main` and take one -argument, an array of strings. +The main method is the entry point of a Scala program. The Java Virtual +Machine requires a main method, named `main`, that takes one +argument: an array of strings. -Using an object, you can define a main method as follows: +Using an object, you can define the main method as follows: ```tut object Main { From bcf565cb7a32cc6835852775661e24a40d896b81 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 20:18:51 +0100 Subject: [PATCH 46/48] Tidy up: add commas and clarifications --- _tour/basics.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/_tour/basics.md b/_tour/basics.md index bf6f43c6e1..3a53bf0ea2 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -57,7 +57,7 @@ Values cannot be re-assigned: x = 3 // This does not compile. ``` -The type of a value can be omitted, and inferred by [type inference](https://docs.scala-lang.org/tour/type-inference.html), or it can be explicitly stated: +The type of a value can be omitted and inferred by [type inference](https://docs.scala-lang.org/tour/type-inference.html), or it can be explicitly stated: ```tut val x: Int = 1 + 1 @@ -75,7 +75,7 @@ x = 3 // This compiles because "x" is declared with the "var" keyword: println(x * x) // 9 ``` -As with values, the type of a variable can be omitted, and inferred by [type inference](https://docs.scala-lang.org/tour/type-inference.html), or it can be explicitly stated: +As with values, the type of a variable can be omitted and inferred by [type inference](https://docs.scala-lang.org/tour/type-inference.html), or it can be explicitly stated: ```tut var x: Int = 1 + 1 @@ -116,7 +116,7 @@ println(addOne(1)) // 2 ``` {% endscalafiddle %} -Functions may take multiple arguments: +A function can take multiple arguments: {% scalafiddle %} ```tut @@ -125,7 +125,7 @@ println(add(1, 2)) // 3 ``` {% endscalafiddle %} -Or it can take no arguments: +Or no arguments at all: ```tut val getTheAnswer = () => 42 @@ -147,7 +147,7 @@ println(add(1, 2)) // 3 Notice how the return type is declared _after_ the parameter list and the `: Int`. -Methods can take multiple parameter lists: +A method can take multiple parameter lists: {% scalafiddle %} ```tut @@ -163,7 +163,7 @@ def name: String = System.getProperty("user.name") println("Hello, " + name + "!") ``` -There are some other differences, but for now, you can think of them as something similar to functions. +There are some other differences, but for now, you can think of methods as something similar to functions. Methods can have multi-line expressions as well: @@ -181,7 +181,7 @@ The last expression in the body is the method's return value. (Scala does have a ## Classes -You can define classes with the `class` keyword followed by its name and constructor parameters: +You can define classes with the `class` keyword, followed by its name and constructor parameters: ```tut class Greeter(prefix: String, suffix: String) { @@ -218,7 +218,7 @@ val anotherPoint = Point(1, 2) val yetAnotherPoint = Point(2, 2) ``` -And case classes are compared by value, not by reference: +Case classes are compared by value, not by reference: ```tut if (point == anotherPoint) { @@ -304,7 +304,7 @@ customGreeter.greet("Scala developer") // How are you, Scala developer? ``` {% endscalafiddle %} -Here, `DefaultGreeter` extends only a single trait, but it could extend multiple traits. +Here, `DefaultGreeter` extends only one single trait, but it could extend multiple traits. We will cover traits in depth [later](traits.html). From b13084c5de3393975acc89d00a5e7c7e8fff0c12 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Wed, 13 Nov 2019 20:21:46 +0100 Subject: [PATCH 47/48] Remove contractions --- _tour/basics.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_tour/basics.md b/_tour/basics.md index 3a53bf0ea2..af68866ec1 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -177,7 +177,7 @@ println(getSquareString(2.5)) // 6.25 ``` {% endscalafiddle %} -The last expression in the body is the method's return value. (Scala does have a `return` keyword, but it's rarely used.) +The last expression in the body is the method's return value. (Scala does have a `return` keyword, but it is rarely used.) ## Classes @@ -189,7 +189,7 @@ class Greeter(prefix: String, suffix: String) { println(prefix + name + suffix) } ``` -The return type of the method `greet` is `Unit`, which signifies that there's nothing meaningful to return. It is used similarly to `void` in Java and C. (A difference is that, because every Scala expression must have some value, there is actually a singleton value of type Unit, written (). It carries no information.) +The return type of the method `greet` is `Unit`, which signifies that there is nothing meaningful to return. It is used similarly to `void` in Java and C. (A difference is that, because every Scala expression must have some value, there is actually a singleton value of type Unit, written (). It carries no information.) You can make an instance of a class with the `new` keyword: @@ -234,7 +234,7 @@ if (point == yetAnotherPoint) { } // Point(1,2) and Point(2,2) are different. ``` -There is a lot more to case classes that we'd like to introduce, and we are convinced you will fall in love with them! We will cover them in depth [later](case-classes.html). +There is a lot more to case classes that we would like to introduce, and we are convinced you will fall in love with them! We will cover them in depth [later](case-classes.html). ## Objects From 7502ee960361855058e4ac029b1886d9dea498b8 Mon Sep 17 00:00:00 2001 From: Tazzle Date: Fri, 6 Dec 2019 14:17:08 +0100 Subject: [PATCH 48/48] Make changes requested in PR comments --- _tour/basics.md | 14 +++++++------- _tour/tour-of-scala.md | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/_tour/basics.md b/_tour/basics.md index af68866ec1..331b026e29 100644 --- a/_tour/basics.md +++ b/_tour/basics.md @@ -57,7 +57,7 @@ Values cannot be re-assigned: x = 3 // This does not compile. ``` -The type of a value can be omitted and inferred by [type inference](https://docs.scala-lang.org/tour/type-inference.html), or it can be explicitly stated: +The type of a value can be omitted and [inferred](https://docs.scala-lang.org/tour/type-inference.html), or it can be explicitly stated: ```tut val x: Int = 1 + 1 @@ -71,11 +71,11 @@ Variables are like values, except you can re-assign them. You can define a varia ```tut var x = 1 + 1 -x = 3 // This compiles because "x" is declared with the "var" keyword: +x = 3 // This compiles because "x" is declared with the "var" keyword. println(x * x) // 9 ``` -As with values, the type of a variable can be omitted and inferred by [type inference](https://docs.scala-lang.org/tour/type-inference.html), or it can be explicitly stated: +As with values, the type of a variable can be omitted and [inferred](https://docs.scala-lang.org/tour/type-inference.html), or it can be explicitly stated: ```tut var x: Int = 1 + 1 @@ -116,7 +116,7 @@ println(addOne(1)) // 2 ``` {% endscalafiddle %} -A function can take multiple arguments: +A function can have multiple parameters: {% scalafiddle %} ```tut @@ -125,7 +125,7 @@ println(add(1, 2)) // 3 ``` {% endscalafiddle %} -Or no arguments at all: +Or it can have no parameters at all: ```tut val getTheAnswer = () => 42 @@ -202,7 +202,7 @@ We will cover classes in depth [later](classes.html). ## Case Classes -Scala has a special type of class called a "case" class. By default, case classes are immutable, and they are compared by value (unlike classes, which are compared by reference). This makes them particularly useful for [pattern matching](https://docs.scala-lang.org/tour/pattern-matching.html#matching-on-case-classes). +Scala has a special type of class called a "case" class. By default, case classes are immutable, and they are compared by value (unlike classes, which are compared by reference). This makes them additionally useful for [pattern matching](https://docs.scala-lang.org/tour/pattern-matching.html#matching-on-case-classes). You can define case classes with the `case class` keywords: @@ -265,7 +265,7 @@ We will cover objects in depth [later](singleton-objects.html). ## Traits -Traits are abstract data types containing certain fields and methods. In Scala inheritance, a class can not only inherit from a super class, but also mix in one or more traits. +Traits are abstract data types containing certain fields and methods. In Scala inheritance, a class can only extend one other class, but it can extend multiple traits. You can define traits with the `trait` keyword: diff --git a/_tour/tour-of-scala.md b/_tour/tour-of-scala.md index f9c1b9325a..2f23fdd254 100644 --- a/_tour/tour-of-scala.md +++ b/_tour/tour-of-scala.md @@ -27,7 +27,7 @@ Scala is a modern multi-paradigm programming language designed to express common Scala is a pure object-oriented language in the sense that [every value is an object](unified-types.html). Types and behaviors of objects are described by [classes](classes.html) and [traits](traits.html). Classes can be extended by subclassing, and by using a flexible [mixin-based composition](mixin-class-composition.html) mechanism as a clean replacement for multiple inheritance. ## Scala is functional ## -Scala is also a functional language in the sense that [every function is a value](unified-types.html). Scala provides a [lightweight syntax](basics.html#functions) for defining anonymous functions, it supports [higher-order functions](higher-order-functions.html), it allows functions to be [nested](nested-functions.html), and it supports [currying](multiple-parameter-lists.html). Scala's [case classes](case-classes.html) and its built-in support for [pattern matching](pattern-matching.html) model algebraic types are used in many functional programming languages. [Singleton objects](singleton-objects.html) provide a convenient way to group functions that aren't members of a class. +Scala is also a functional language in the sense that [every function is a value](unified-types.html). Scala provides a [lightweight syntax](basics.html#functions) for defining anonymous functions, it supports [higher-order functions](higher-order-functions.html), it allows functions to be [nested](nested-functions.html), and it supports [currying](multiple-parameter-lists.html). Scala's [case classes](case-classes.html) and its built-in support for [pattern matching](pattern-matching.html) provide the functionality of algebraic types, which are used in many functional languages. [Singleton objects](singleton-objects.html) provide a convenient way to group functions that aren't members of a class. Furthermore, Scala's notion of pattern matching naturally extends to the [processing of XML data](https://github.com/scala/scala-xml/wiki/XML-Processing) with the help of [right-ignoring sequence patterns](regular-expression-patterns.html), by way of general extension via [extractor objects](extractor-objects.html). In this context, [for comprehensions](for-comprehensions.html) are useful for formulating queries. These features make Scala ideal for developing applications like web services.