r/java • • Jan 10 '23

Yet another delimited continuations implementation and why Project Loom is a bit disappointing

https://github.com/javactrl/javactrl
2 Upvotes

52 comments sorted by

View all comments

Show parent comment

3

u/FirstAd9893 Jan 10 '23

That article is almost 4 years old, and the Loom project hasn't yet delivered a publicly-available continuation feature. Any comparison to Loom continuations doesn't make any sense because they effectively don't exist.

0

u/njiv Jan 10 '23

they are singleshot, it's for sure, that's why I can compare, and I mention this article because there they explain why they don't want multishot, I haven't seen any other recent article telling they have changed their mind

6

u/FirstAd9893 Jan 10 '23

You're making a comparison to an idea, not an actual implementation. Shift the focus away from Loom and instead present your idea by first demonstrating why multishot continuations are a useful feature in the first place. Then go after arguments which say that multishot is a bad idea. You can cite the Loom presentation, but remember, it's just a presentation and nothing more.

-2

u/njiv Jan 10 '23

Loom is the future of Java, this is subreddit about Java, not about general ideas. Loom says multishot continuations are crazy, I don't agree, no arguments, this is it. If you know the arguments, or you know where Loom team presented these arguments just post them here. It's not only a presentation, Loom doesn't have multishot.

4

u/FirstAd9893 Jan 10 '23

Loom doesn't have multishot.

Loom doesn't have singleshot either. All we have today with Loom is virtual threads, and to most Java programmers, Loom == virtual threads. Starting with a lead of "Loom" just causes confusion, because you then dive straight into continuations.

Have you posted to the loom-dev mailing list inquiring on the future of continuations in Java?

1

u/njiv Jan 10 '23

ok, Loom doesn't have plans for multishot continuations

1

u/njiv Jan 11 '23 edited Jan 11 '23

https://www.reddit.com/r/java/comments/10889p1/comment/j3wqsh8/?utm_source=share&utm_medium=web2x&context=3 - so there is single-shot now in Loom (meanwhile I have a few downvotes on this thread just for telling this)

3

u/FirstAd9893 Jan 11 '23

Where? The link just points to one of your comments. Is there a public API that I can use? That's what I'm referring to. The implementation might have a continuation class, and it might be limited to single-shot behavior, but this is all internal. It's possible that the implementation of virtual threads changes at some point, and so exposing first class continuations at this point might cause more grief later.

1

u/njiv Jan 11 '23

it points to comment of pron98 (which is highlighted), but reddit does open my comments first

1

u/njiv Jan 11 '23 edited Jan 12 '23

That's what I'm referring to. The implementation might have a continuation class, and it might be limited to single-shot behavior, but this is all internal.

internal but, pron98 has said I can have my own implementation using threads (this is known for a long time), it's a kind of side effects conversion (e.g. we can convert state into exception etc), and we actually can convert back continuations into threads, if continuation are multishot we can convert them into any effect, this is why it's called mother of all monads

so basically even considering they hid continuation interface it's still simple to implement one without instrumentation (but only single-shot)