Remix.run Logo
wouldbecouldbe 8 days ago

It looks like chaining, but with possibility of adding custom functions?

bapak 8 days ago | parent [-]

It's chaining without having to vary the return of each function. In JS you cannot call 3.myMethod(), but you could with 3 |> myMethod

cyco130 8 days ago | parent | next [-]

It requires parentheses `(3).myMethod()` but you can by monkey patching the Number prototype. Very bad idea, but you absolutely can.

senfiaj 2 days ago | parent [-]

You can just add extra dot: `3..myMethod()`.

EGreg 7 days ago | parent | prev [-]

Not only that

In chaining, methods all have to be part of the same class.

In C++ we had this stuff ages ago, it’s called abusing streaming operators LMAO