Open weepy opened 7 years ago
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:
const {map} = Array.prototype
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
Lua does something similar - from https://www.lua.org/pil/5.html
It wouldn't help with using
const {map} = Array.prototype
but it would allow functional thisless pure pipelines. E.g:would be compiled to
Allowing functions to be written like like :