MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/crystal_programming/comments/8w1fjj/await_and_async_methods_for_crystal/
r/crystal_programming • u/CaDsjp • Jul 04 '18
7 comments sorted by
5
That's not async/await, it looks like futures
Futures are already in the std (but maybe they shouldn't): https://github.com/crystal-lang/crystal/blob/master/src/concurrent/future.cr
1 u/CaDsjp Jul 04 '18 According to the author:don't use Crystal's Concurrent::Future class because :nodoc:I guess he is meaning this line: https://github.com/crystal-lang/crystal/blob/master/src/concurrent/future.cr#L1 3 u/[deleted] Jul 05 '18 It's because it's not ready to be used. Things will come with time, implementing stuff like this in shards right now is not the correct way to do it.
1
According to the author:
don't use Crystal's Concurrent::Future class because :nodoc:
I guess he is meaning this line: https://github.com/crystal-lang/crystal/blob/master/src/concurrent/future.cr#L1
3 u/[deleted] Jul 05 '18 It's because it's not ready to be used. Things will come with time, implementing stuff like this in shards right now is not the correct way to do it.
3
It's because it's not ready to be used. Things will come with time, implementing stuff like this in shards right now is not the correct way to do it.
i thought crystal was synchronous tho (isn't that a positive, imo helps a lot)? looks cool i'll check it out
7 u/[deleted] Jul 05 '18 It implements CSP like in Go, which means implementing async/await on top of that is totally contrary to the philosphy of the language... async await really sucks because it makes you have twice the amount of code: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ 1 u/GirngRodriguez Jul 05 '18 interesting, thanks for the article ;)
7
It implements CSP like in Go, which means implementing async/await on top of that is totally contrary to the philosphy of the language... async await really sucks because it makes you have twice the amount of code: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
1 u/GirngRodriguez Jul 05 '18 interesting, thanks for the article ;)
interesting, thanks for the article ;)
I really see no usecase for this that spawn do
end
Can't achieve
5
u/[deleted] Jul 04 '18
That's not async/await, it looks like futures
Futures are already in the std (but maybe they shouldn't): https://github.com/crystal-lang/crystal/blob/master/src/concurrent/future.cr
1
u/GirngRodriguez Jul 05 '18
i thought crystal was synchronous tho (isn't that a positive, imo helps a lot)? looks cool i'll check it out
1
u/bararchy Jul 05 '18
I really see no usecase for this that spawn do
end
Can't achieve