KOTLIN_BROADCAST Telegram 1856
Уже успели попробовать в продакшен проектах Kotlin Context Parameter? Появились в Kotlin 2.2.0 в экспериментальном режиме. Делитесь впечатлениями

// UserService defines the dependency required in the context
interface UserService {
fun log(message: String)
fun findUserById(id: Int): String
}

// Declares a function with a context parameter
context(users: UserService)
fun outputMessage(message: String) {
// Uses log from the context
users.log("Log: $message")
}

// Declares a property with a context parameter
context(users: UserService)
val firstUser: String
// Uses findUserById from the context
get() = users.findUserById(1)
10👍6



tgoop.com/kotlin_broadcast/1856
Create:
Last Update:

Уже успели попробовать в продакшен проектах Kotlin Context Parameter? Появились в Kotlin 2.2.0 в экспериментальном режиме. Делитесь впечатлениями

// UserService defines the dependency required in the context
interface UserService {
fun log(message: String)
fun findUserById(id: Int): String
}

// Declares a function with a context parameter
context(users: UserService)
fun outputMessage(message: String) {
// Uses log from the context
users.log("Log: $message")
}

// Declares a property with a context parameter
context(users: UserService)
val firstUser: String
// Uses findUserById from the context
get() = users.findUserById(1)

BY Kotlin Multiplatform Broadcast


Share with your friend now:
tgoop.com/kotlin_broadcast/1856

View MORE
Open in Telegram


Telegram News

Date: |

With Bitcoin down 30% in the past week, some crypto traders have taken to Telegram to “voice” their feelings. Polls The group also hosted discussions on committing arson, Judge Hui said, including setting roadblocks on fire, hurling petrol bombs at police stations and teaching people to make such weapons. The conversation linked to arson went on for two to three months, Hui said. The optimal dimension of the avatar on Telegram is 512px by 512px, and it’s recommended to use PNG format to deliver an unpixelated avatar. Choose quality over quantity. Remember that one high-quality post is better than five short publications of questionable value.
from us


Telegram Kotlin Multiplatform Broadcast
FROM American