Hacker News new | ask | show | jobs
by goatlover 3451 days ago
You mean it's prototypal, like Self, IO, Javascript?
1 comments

No, 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.)