Уже успели попробовать в продакшен проектах 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)
Уже успели попробовать в продакшен проектах 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)
best-secure-messaging-apps-shutterstock-1892950018.jpg Just at this time, Bitcoin and the broader crypto market have dropped to new 2022 lows. The Bitcoin price has tanked 10 percent dropping to $20,000. On the other hand, the altcoin space is witnessing even more brutal correction. Bitcoin has dropped nearly 60 percent year-to-date and more than 70 percent since its all-time high in November 2021. To upload a logo, click the Menu icon and select “Manage Channel.” In a new window, hit the Camera icon. A Hong Kong protester with a petrol bomb. File photo: Dylan Hollingsworth/HKFP. Ng Man-ho, a 27-year-old computer technician, was convicted last month of seven counts of incitement charges after he made use of the 100,000-member Chinese-language channel that he runs and manages to post "seditious messages," which had been shut down since August 2020.
from us