3 ms·
You mean it's prototypal, like Self, IO, Javascript?
by goatlover 10y ago
You mean it's prototypal, like Self, IO, Javascript?
- abecedarius 10y agoNo, it's similar to creating an object this way in ES6: function makeVector(x, y) { return { norm: () => Math.sqrt(x*x + y*y), // ... more methods ... }; } but frozen so that consumers can't change it except by calling a method. It's odd how this is the 'obvious' way to generalize lambda expressions from functions to objects, yet it's rare to see this style, and you always have to clarify that you're not talking about prototypes. (IIRC Emerald, mentioned in the paper, also works something like this.)