Hacker News new | past | comments | ask | show | jobs | submit login

No, it clearly isn't. A Future, from Java 5's concurrency libs is close, but it doesn't offer the chaining construction -- it only offers get. The most similar-looking code commonly used in Java is probably people who use Option (or Maybe for those who stole from Haskell instead) with a .transform.

I don't think there's as much a need for it in Java because I'm less likely to want to write defensive code in that way outside of the browser.

It looks like Play supplies F.Promise, which provides the same functionality with a different API. I do like the simplicity of the API in the JS promises. The something.transform(good, bad, progress) is very easy to understand from the start.




I've never thought of the two mentioned monads (Promise and Option) as defensive. Option doesn't seem defensive because sometimes you need to represent the possibility that there is no value to be returned.

Could you elaborate on how it's defensive?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: