Andrew, "pipe improvements" are common proposals to the mailing list that
are always rejected. Please search for previous discussions on the topic
for more information.



*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R&D

On Mon, Jul 10, 2017 at 9:01 AM, <and...@paypip.com> wrote:

> Hi guys,
>
> I see a lot of libraries try to allow piping to the first parameter by
> default, but some don't support this easily.
>
> I propose the following syntax to remedy this where it's needed to pipe to
> a specific parameter:
>
> 1) Normal pipe clearly works the same:
>
> %{} |> SomeCode.function(other_params) === SomeCode.function(%{},
> other_params)
>
> 2) The number of > dictates the position of the function we want to pipe
> into:
>
> %{} |>> SomeCode.function("param1") === SomeCode.function("param1", %{})
>
> 3) We could also supply opts and other params:
>
> %{} |>> SomeCode.function("param1", %{opts_are_param_3: true}) ===
> SomeCode.function("param1", %{}, %{opts_are_param_3: true})
>
> 4) We can move to any specific param we want with more arrows, maybe limit
> it to 4, say to avoid it becoming ridiculous.
>
> %{} |>>> SomeCode.function("param1", %{this_is_param_2: true}) ===
> SomeCode.function("param1", %{this_is_param_2: true}, %{})
>
> Thoughts?  Would other people find this useful in some situations?
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/elixir-lang-core/2f2e23c7-bbbc-4c20-b177-
> 95dea8628752%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/2f2e23c7-bbbc-4c20-b177-95dea8628752%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BK-aLAB%2BF8_oWYd9mdSgEDZMCmubdmAMwnAS1pp4%3DZ_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to