-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
@@ -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. |
There was a problem hiding this comment.
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 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. | ||
|
||
## 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. |
There was a problem hiding this comment.
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
right — not written from scratch, just relocated out of overviews |
replaced by #1012 |
No description provided.