- src/main/scala/Main.scala
object Main {
def main(args: Array[String]): Unit = {
println("hello scala!")
| import scala.language.implicitConversions | |
| // FlipFlap型クラスを定義 | |
| trait FlipFlap[T] { | |
| // このメソッドはアドホック多相を実現する | |
| def flipFlap(x: T): T | |
| } | |
| // Int をFlipFlap型クラスの型インスタンスとして定義 | |
| implicit val intFlipFlap = new FlipFlap[Int] { |
| class Module | |
| def wrap_package_private name | |
| wraped_method = instance_method(name) | |
| define_method(name) do |*args| | |
| # check | |
| puts "checking package_private: #{name}" | |
| if true | |
| e = NoMethodError.new("package private method is called from outside of the package") | |
| e.set_backtrace caller |
Original: "Callbacks are imperative, promises are functional: Node's biggest missed opportunity" by James Coglan
Translated by Yuta Okamoto (@okapies)