kotlin

kotlin

dev4mobile

scp -rv channels root@112.84.124.13:/data/www/v1.0.1

弊端: 不能覆盖原有目录

rsync 替代scp


fun sayHello(name: String) {
  println("method $name invoked!")
}

fun log(message: String):((String) -> Unit) -> (String) -> Unit {

  val decorateFunc = fun (foo: (String) -> Unit): (String) -> Unit {
    val middleFunc = fun(name: String) {
      println("method invoked before log: $message")
      foo(name)
      println("method invokde after log: $message")
    }
    return middleFunc
  }
  return decorateFunc
}

fun main(args: Array<String>) {
  val decorateFunc = log("logging")(::sayHello)
  decorateFunc("sayHelloWorld")
}
仅仅只是调用返回函数,并没有执行语句

avoid the use inheritance 
use by (kotlin delegate)

https://medium.com/rocket-fuel/kotlin-by-class-delegation-favor-composition-over-inheritance-a1b97fecd839
lazy, map, observable vetoable, notnull


Report Page