proposal-bind-operator icon indicating copy to clipboard operation
proposal-bind-operator copied to clipboard

a bit like Lua !

Open weepy opened this issue 9 years ago • 1 comments

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()
}

weepy avatar Dec 09 '16 21:12 weepy

Also see https://github.com/mindeavor/es-pipeline-operator

calebmer avatar Dec 09 '16 22:12 calebmer