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: |

4How to customize a Telegram channel? On Tuesday, some local media outlets included Sing Tao Daily cited sources as saying the Hong Kong government was considering restricting access to Telegram. Privacy Commissioner for Personal Data Ada Chung told to the Legislative Council on Monday that government officials, police and lawmakers remain the targets of “doxxing” despite a privacy law amendment last year that criminalised the malicious disclosure of personal information. Ng was convicted in April for conspiracy to incite a riot, public nuisance, arson, criminal damage, manufacturing of explosives, administering poison and wounding with intent to do grievous bodily harm between October 2019 and June 2020. How to Create a Private or Public Channel on Telegram? More>>
from us


Telegram Kotlin Multiplatform Broadcast
FROM American