Much as I love to hear my code described as "perfect" :-), I'm going to 
push back. The pipe chain looks pretty funky to me and I think there's an 
easy, backward-compatible change that could be made to satisfy all involved:

def stream(subscription, options) when is_pid(subscription) do
  GenStage.stream([subscription], options)
end

… and accompanying documentation updates. If that's appealing, I'm happy to 
write the PR.

-Eric


On Wednesday, October 26, 2016 at 3:07:41 AM UTC-7, José Valim wrote:
>
> Your code is perfect as is. Small private functions are really helpful so 
> keep doing it. We don't plan to change GenStage. :)
>
>
>
> *José Valim*
> www.plataformatec.com.br
> Skype: jv.ptec
> Founder and Director of R&D
>
> On Wed, Oct 26, 2016 at 5:03 AM, <[email protected] <javascript:>> wrote:
>
>> While I understand the desire to make a stream out of multiple GenStages, 
>> I find myself writing this snippet of code frequently …
>>
>>   defp gen_stage_to_stream(pid) when is_pid(pid) do
>>     GenStage.stream([pid])
>>   end
>>
>> … so I can then use the stream in a pipe chain.
>>
>> This seems a bit cumbersome. Any hope for a version of GenStage.stream 
>> that accepts a single pid outside of a list?
>>
>> I'm open to writing a PR if the team is amenable to this.
>>
>> -Eric
>>
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elixir-lang-core/899f7862-b5dd-445e-9bff-265fb0587511%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elixir-lang-core/899f7862-b5dd-445e-9bff-265fb0587511%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/1aed7bd2-5dec-40ee-a6e0-b26ffe2deb8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to