Is there a way to easily make multiple names for a...
# general-advice
c
Is there a way to easily make multiple names for a single function without having to redeclare them entirely? Mainly for DSL/operator purposes. For example:
Copy code
fun foo(arg1: String, arg2: String) {
  // ...
}

// Known:
fun bar(arg1: String, arg2: String) = foo(arg1, arg2)

// Ideal?
fun bar = foo
s
For simple cases, this should work:
Copy code
fun main() {
  fun foo(arg1: String, arg2: String) {
    // ...
  }

  val bar = ::foo

  bar("1", "2")
}
It won't really work with overloads though