Born out of the idea that it'd be cool for code to communicate that we are asking the computer to do something.
My thinking is that this would be helpful in teaching programming to students, so that the code they read helps them internalize that they are giving the computer instructions.
So instead, of:
const bunny = {
hop: () => {...}
}
bunny.hop(); // from this
They would read (and write):
const bunny = {
hop: () => {...}
}
ask(bunny).to("hop"); // to this
Not convinced that's better? Well, fair enough. After all, it is longer, which we as programmers don't like. (NOTE: It is type-safe though, thanks to the joys of Typescript. Getting that working was very satisfying!)
But I think this pattern comes alive when we are interacting with many objects. Like below:
// work in progress
And as a side effect, this allows us to do some really cool stuff around subscribing to function calls. Because there's a central mechanism for calling functions (the ask(___).to(___)
mechanism), we can create some really interesting effects with very minimal code.
Like consider the following:
// work in progress
Overall, I don't think this strategy encourages good behavior. The code is pretty readable, but not maintainable, since