$ gem install vagrant
Original: "Callbacks are imperative, promises are functional: Node's biggest missed opportunity" by James Coglan
Translated by Yuta Okamoto (@okapies)
- 訳者は JavaScript や Node.js に関する専門知識がほとんどありません。識者のツッコミをお待ちしております。「◯◯が分からない」等も歓迎です。
- 元記事から構成を一部変更しています。また、関数型プログラミングに関する記述のうち、議論の骨子に絡まないものは省略しています。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.language.implicitConversions | |
// FlipFlap型クラスを定義 | |
trait FlipFlap[T] { | |
// このメソッドはアドホック多相を実現する | |
def flipFlap(x: T): T | |
} | |
// Int をFlipFlap型クラスの型インスタンスとして定義 | |
implicit val intFlipFlap = new FlipFlap[Int] { |