The more I look at this, the less I like it. If you really want to name the
concept, why not go the extra mile and go to a named function?

Just my opinion.

-bt

On Fri, Aug 9, 2019 at 12:43 PM Miguel Palhas <[email protected]> wrote:

> The idea sounds interesting. You just got me thinking "do I avoid piping
> to anonymous functions only because I dislike the current syntax?")
> Looking through my current project, I notice that more often than not,
> when I find myself needing something similar, I take that as a hint and
> extract the logic to a separate function:
>
> value
> |> do_stuff
>
> defp do_stuff(value)
>   # ...
> end
>
> I like this approach better, as it makes the whole code even more explicit
> (I'm forced to come up with a meaningful name for that function). So I
> don't see myself using that function either.
>
> Another concern I'm thinking of is the name. Mentally, how do you read "|>
> pipe_to(...)"?
> Because I'm reading it as "pipe to pipe_to", which can turn out to be
> confusing
>
> On Fri, Aug 9, 2019 at 4:20 PM José Valim <[email protected]>
> wrote:
>
>> The partial application was just the example of choice. It can be any
>> anonymous function as argument.
>>
>> On Fri, Aug 9, 2019 at 16:39 Bruce Tate <[email protected]> wrote:
>>
>>> It's interesting to me. You have two things happening there:
>>>
>>> - partial application
>>> - the  anonymous function invocation syntax.
>>>
>>> Which one are you solving here?
>>>
>>> -bt
>>>
>>> -bt
>>>
>>> On Fri, Aug 9, 2019 at 9:28 AM José Valim <
>>> [email protected]> wrote:
>>>
>>>> Hi everyone,
>>>>
>>>> With the addition of Function.identity/1, I would like to propose
>>>> another function to the Function module: pipe_to/2.
>>>>
>>>> The idea is that instead of:
>>>>
>>>> "foo
>>>> |> String.upcase()
>>>> |> (&Regex.scan(~r/foo/, &1)).()
>>>>
>>>> One can do:
>>>>
>>>> "foo
>>>> |> String.upcase()
>>>> |> Function.pipe_to(&Regex.scan(~r/foo/, &1))
>>>>
>>>> Or if you import it before:
>>>>
>>>> "foo
>>>> |> String.upcase()
>>>> |> pipe_to(&Regex.scan(~r/foo/, &1))
>>>>
>>>> While I wouldn't write the "pipe to anonymous" code, I have seen enough
>>>> code in the wild that uses it that having a more readable (albeit more
>>>> verbose) approach in the language sounds reasonable to me. The
>>>> implementation can be inlined by the compiler to avoid the extra dispatch
>>>> cost.
>>>>
>>>> What are your thoughts? If you "pipe to anonymous functions" in your
>>>> code today, would you prefer to use the new function? Yes/no? Why?
>>>>
>>>> Thank you,
>>>>
>>>> *José Valim*
>>>> www.plataformatec.com.br
>>>> Skype: jv.ptec
>>>> Founder and Director of R&D
>>>>
>>>> --
>>>> 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 [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4L-4zcvLOnOFSFdnmk0foBJcu94QjrAv9-_QDySN%2BN9bg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4L-4zcvLOnOFSFdnmk0foBJcu94QjrAv9-_QDySN%2BN9bg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>
>>>
>>>>
>>>
>>> --
>>>
>>> Regards,
>>> Bruce Tate
>>> CEO
>>>
>>>
>>> <https://bowtie.mailbutler.io/tracking/hit/f8218219-d2a8-4de4-9fef-1cdde6e723f6/c7c97460-016e-45fb-a4ab-0a70318c7b97>
>>>
>>> Groxio, LLC.
>>> 512.799.9366
>>> [email protected]
>>> grox.io
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/elixir-lang-core/CAFXvW-6pChjS%2BfTADa9_1sMow4A5S88azM_FDqKOcxDxNJXakg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/elixir-lang-core/CAFXvW-6pChjS%2BfTADa9_1sMow4A5S88azM_FDqKOcxDxNJXakg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>>
>>
>> *José Valim*
>> www.plataformatec.com.br
>> Skype: jv.ptec
>> Founder and Director of R&D
>>
>> --
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4L-Qx2tdNTaNiKkGve0%3Dx1J_7esSJKH68k3zzYURCHGeg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4L-Qx2tdNTaNiKkGve0%3Dx1J_7esSJKH68k3zzYURCHGeg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Best,
> Miguel Palhas
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/CAEmrurpqEtb-9_A1EqdQXkBcWio0w6uwxF_CN2dipj8xt_%2BWcQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CAEmrurpqEtb-9_A1EqdQXkBcWio0w6uwxF_CN2dipj8xt_%2BWcQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 

Regards,
Bruce Tate
CEO

<https://bowtie.mailbutler.io/tracking/hit/f8218219-d2a8-4de4-9fef-1cdde6e723f6/c7c97460-016e-45fb-a4ab-0a70318c7b97>

Groxio, LLC.
512.799.9366
[email protected]
grox.io

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAFXvW-6FK_yVxJUaQnpwZcuhJk%2BQ0Pq2YiULw3giW0jjnXWNNg%40mail.gmail.com.

Reply via email to