// util.js
export const toSet = iterable => new Set(iterable)
import * as util from './util.js'
[]::util:toSet();// why here equals to `util.toSet([])`, but not `util.toSet.call([])`?
If so, why not use |> syntax instead?
In my opinion, value|>step1|>step2|>step3 syntax suits util that designed to use without other args,
while value::step1(true)::step2()::step3('yes', 1) syntax suits util that designed to use with other args.
The both proposals are mainly to avoid writting backward logic like step3(step2(step1(value))),
but do chain thing like $(value).step1().step2().step3() more easily, free, and fast.
If :: want to cover the use cases that |> does, and |> want to cover the multiple arguments use cases which should leave to ::, the situation would be a mess...
If so, why not use
|>syntax instead?In my opinion,
value|>step1|>step2|>step3syntax suits util that designed to use without other args,while
value::step1(true)::step2()::step3('yes', 1)syntax suits util that designed to use with other args.The both proposals are mainly to avoid writting backward logic like
step3(step2(step1(value))),but do chain thing like
$(value).step1().step2().step3()more easily, free, and fast.If
::want to cover the use cases that|>does, and|>want to cover the multiple arguments use cases which should leave to::, the situation would be a mess...