Live data from Hacker News

Trickle: Spotify's library for composing asynchronous code in Java

github.com

11–18 of 18 posts

Re: Trickle: Spotify's library for composing asynchronous code in Java

#11
post #2

This looks promising. The syntax is a bit clunky, however. How would this look with Java8 and lambdas?

Agreed, it looks super clunky. Even JS feels clunky for me at times for async stuff, compared to, say CoffeeScript. But I suppose it's possibly the case that async isn't used as much in Java, compared to its ubiquity in the browser.

Re: Trickle: Spotify's library for composing asynchronous code in Java

#12
post #10

Earlier quoted context omitted.

Nice write-up. I'm surprised people don't mind chaining together the information flow like this; it feels more like the runtime should do this sort of leg work. I understand why you'd do this on servers, but not as much on clients. Why not tie up a worker thread waiting for these things?

I agree, you're unlikely to feel the need for this when threads are cheap and blocking is OK. (For some client environments, like JavaScript, that's not the case: which is why you see so many similar things in that space, like promises and bacon.js.) Though in some languages the syntax is light enough that it's actually more convenient to do in in the nonblocking style; Scala has a good story here, and C#'s async/awa…

That's what pains me about JS: there's this meme of being unable to use threads, but it's OK, because threads are bad and scary. Thus, promises must be good.

Async/await is beautiful: compiler produces CPS, but logical control flow remains exactly as you'd expect. One slight reservation: the async specifier seems to pollute the entire call tree of otherwise un-related code.

Re: Trickle: Spotify's library for composing asynchronous code in Java

#18

I'm curious — how does this deal with errors in async calls? RxJava has error handling built in with `onError` functions.

Trickle has a similar concept - you can add a 'fallback' to a node: https://github.com/spotify/trickle/blob/master/src/examples/...
Post reply on HN