4 ms·
also, i just made a possibly interesting connection with JS methods (and their weirdness). in the above implementation, a message is first class, so you can sen
by uryga 6y ago
also, i just made a possibly interesting connection with JS methods (and their weirdness). in the above implementation, a message is first class, so you can send the same message to multiple objects:
let moveUp = ['move', [0, 1]];
p1(...moveUp)
p2(...moveUp)
but you can't get a `move` that's "bound" to a particular object¹ – the "receiver" is decided when you "send" the message. which reminds me of how JS methods work: `this` is bound to what's "to the left of the dot" when you call a method, so unlike Python,
obj.foo(1)
is not the same as
let f = obj.foo
f(1) // Error: 'this' is undefined
maybe there's a connection to some language that inspired JS' OO model, with prototypes and all that?
---
¹ well, unless you explicitly wrap it in another closure like
(args) => p1('move', args)