-
Notifications
You must be signed in to change notification settings - Fork 4.1k
minor fix for typo, indent, link, and sample code, etc #4905
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
base: master
Are you sure you want to change the base?
Conversation
**Stabilized `@SubclassOptInRequired`** | ||
|
||
* KEEP proposal: [subclass-opt-in-required.md](https://github.com/Kotlin/KEEP/blob/master/proposals/subclass-opt-in-required.md) | ||
* YouTrack issue: [KT-54617](https://youtrack.jetbrains.com/issue/KT-54617) | ||
* Available since: 2.1.0 | ||
|
||
</td> | ||
</tr> | ||
|
||
<tr filter="stable"> | ||
<td> | ||
|
||
**Stable** | ||
|
||
</td> | ||
<td> | ||
|
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.
JFYI
I moved this one from IN PREVIEW BLOCK
to STABLE BLOCK
@@ -45,7 +45,7 @@ Consider this example that extends the `StringBuilder` class: | |||
```kotlin | |||
fun main() { | |||
// Lambda expression with receiver definition | |||
fun StringBuilder.appendText() { append("Hello!") } | |||
val appendText: StringBuilder.() -> Unit = { append("Hello!") } |
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.
JFYI
I think the lambda expression with receiver
should be like this
the original sample code is NOT a lambda expression with receiver
, but a local extension function
.
also, the following paragraph explains:
The lambda expression assigned to
appendText
.....
so I think it should be val appendText = ....
here
* The `Cat` class inherits from the `Mammal` sealed class and uses the `catName` parameter in its own constructor as | ||
the `name` parameter from the `Mammal` class. | ||
* The `Human` class inherits from the `Mammal` sealed class and uses the `humanName` parameter in its own constructor as | ||
the `name` parameter from the `Mammal` class. It also has the `job` parameter in its constructor. |
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.
JFYI
I think it should be:
the child classes use the param in in its own constructor
, as the parameter from parent class
fix me if I am wrong.
@@ -204,7 +204,7 @@ In these functions: | |||
* The `operator` keyword marks these functions as operator functions, enabling them to overload the `get()` and `set()` functions. | |||
* The `thisRef` parameter refers to the object **containing** the delegated property. By default, the type is set to `Any?`, but you may need to declare a more specific type. | |||
* The `property` parameter refers to the property whose value is accessed or changed. You can use this parameter to access information | |||
like the property's name or type. By default, the type is set to `Any?`. You don't need to worry about changing this in your code. | |||
like the property's name or type. By default, the type is set to `KProperty<*>`. You don't need to worry about changing this in your code. |
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.
JFYI
property
in delegate, should be KProperty<*>
@@ -126,7 +126,7 @@ fun main() { | |||
{kotlin-runnable="true" id="kotlin-tour-scope-function-let-non-null"} | |||
|
|||
The example: | |||
* Creates a variable called `confirm`. | |||
* Creates a variable called `address`. |
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.
JFYI
it's address
in the sample code
@@ -288,7 +288,7 @@ The example: | |||
* Uses the `.map()` extension function on the `medals` variable. | |||
* Passes a lambda expression to the `.map()` function that refers to `medals` via the `it` keyword and calls the `.uppercase()` extension function on it. | |||
* Uses the `.filter()` extension function on the `medals` variable. | |||
* Passes a lambda expression as a predicate to the `.filter()` function that refers to `medals` via the `it` keyword and checks if the length of the list contained in the `medals` variable is longer than 4 items. | |||
* Passes a lambda expression as a predicate to the `.filter()` function that refers to `medals` via the `it` keyword and checks if the length of the string contained in the `medals` variable is longer than 4 characters. |
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.
JFYI
it's string
, instead of list
Change List
’
char to'
char