Hi Fernando,
Great work on this implementation! However, there are a few edge cases that
you do not handle. E.g.
async with a <- 1,
b <- :timer.sleep(1000),
c <- IO.inspect(a),
d <- {a, b} do
...
end
That *should* print out "1" immediately because c only has a dependency on
a and is unrelated to b, however, your implementation does not. I've been
discussing some of these edge cases with José, Luke Imhoff, et al for a few
months and slowly built up this gist.
<https://gist.github.com/hunterboerner/96bc022d1ac131c21c4ce7f12756d0c3> As
you can see, that gist is a complete mess so Luke and I began to rewrite it
in https://github.com/kronicdeth/async_with. John Wahba proposed an
alternative implementation to me at ElixirConf that eliminates the need to
compute a dependency graph so we're going to be implementing that version
sometime soon and share it here when we have a working version on GitHub.
- Theron
On Fri, Sep 8, 2017 at 5:07 AM Fernando Tapia Rico <[email protected]>
wrote:
> I wanted to share with you guys https://github.com/fertapric/async_with,
> which is the implementation of "async with", one of the "José goes crazy"
> ideas mentioned in this proposal :) I hope you like it!
>
> Any feedback or help is more than welcome!
>
> On Thursday, November 19, 2015 at 4:54:15 PM UTC+1, José Valim wrote:
>
>> Please open up an issue. If we support such, we would need to support it
>> both on "comprehensions" and "with".
>>
>
>>
>>
>> *José Valim*
>> www.plataformatec.com.br
>> Skype: jv.ptec
>> Founder and Director of R&D
>>
>> On Thu, Nov 19, 2015 at 5:05 PM, Vincent Siliakus <[email protected]>
>> wrote:
>>
>>> Op zaterdag 14 november 2015 13:57:08 UTC+1 schreef José Valim:
>>>>
>>>> The implementation is already in master thanks to lexmag. :)
>>>>
>>>>
>>> Works great, I love this addition!
>>>
>>> I was wondering though since the current implementation uses 'case'
>>> internally, if support for something like this is still planned:
>>>
>>> with x when x < 2 <- 4, do: :ok
>>> => 4
>>>
>>> with x when x > 2 <- 4, do: :ok
>>> => :ok
>>>
>>> I think this would allow even more clunky, nested code to be rewritten
>>> much more elegantly with 'with'.
>>>
>>>
>> --
> 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/9a5fb079-07a7-44d4-ab3d-d6ab1ab8a9bd%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/9a5fb079-07a7-44d4-ab3d-d6ab1ab8a9bd%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/CAOtk34fppjVS4onvZ%3DSfs%2BMTJ2zU57o9cmWarMXTLDTJq-8yMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.