proposal-bind-operator
proposal-bind-operator copied to clipboard
a bit like Lua !
Lua does something similar - from https://www.lua.org/pil/5.html
An expression like o:foo(x) is just another way to write o.foo(o, x), that is, to call o.foo adding o as a first extra argument.
It wouldn't help with using const {map} = Array.prototype but it would allow functional thisless pure pipelines. E.g:
a::map( upperCase )::filter( s => s.length > 5 )
would be compiled to
filter( map(a, upperCase), (s) => s.length > 5)
Allowing functions to be written like like :
function upperCase(name) {
return name.toUpper()
}
Also see https://github.com/mindeavor/es-pipeline-operator