Hacker News new | ask | show | jobs
by cel1ne 3387 days ago
Also in Kotlin you can have extension methods with multiple receivers:

    class Dictionary {
       val wordList = setOf<String>()

       fun String.isWord(word): Boolean = 
          word in wordList
    }

    ...

    val myDictionary = Dictionary()
    
    with (Dictionary) {
        println("dog".isWord)
    }

    (you can skip the "with" when being inside Dictionary)