Skip to content

Mention implicit classes and string interpolation in the tour intro (fixes #992) #1004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions _tour/tour-of-scala.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,9 @@ In practice, the development of domain-specific applications often requires doma
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 [annotations](annotations.html) and Java generics 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.

Please continue to the [next page](basics.html) in the Contents menu to read more.

## Implicit classes in Scala ##
Scala offers a language construct called implicit class which simplifies the creation of classes that provide extension methods to another type.Classes annotated with the implicit keyword are referred to as implicit classes.For an implicit class to work, its name must be in scope and unambiguous.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing spaces after the periods in this line

I'd suggest using backticks here: "Classes annotated with the implicit keyword"


## Scala offers string interpolation ##
With mechanism of string interpolation, Scala enables users too embed variables in string literals.Scala offers three string interpolation methods out of the box: `s`, `f` and `raw`.Prepending `s` to any string literal allows the usage of variables directly in the string.Prepending `f` to any string literal allows the creation of simple formatted strings.The raw interpolator is similar to the `s` interpolator except that it performs no escaping of literals within the string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too embed -> to embed

missing spaces after periods again

you can just say "string interpolators" instead of "string interpolation methods"

instead of "out of the box", I would suggest "in the standard library"

I feel like the level of detail here is probably inappropriate for this page. It isn't necessary to cover f and raw here, 95% or even 99% of the time what you see in actual code is just the s interpolator.

The details remain available at http://docs.scala-lang.org/overviews/core/string-interpolation.html