IO-style prototypical inheritance in JavaScript