Rendered at 23:26:30 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
cchianel 3 hours ago [-]
I implemented continuations (required for Python generators) differently in my Python (AST) to Java (bytecode) translator. The switch dispatch to restore variables and jump to next location is the same, but instead of throwing an exception, I treated each function as its own class and stored the stack, variables, etc. on the class (relevant code: https://github.com/cdis-vm/cdis2java/blob/main/src/main/java...). When you "call" the generator, what you actually get is a new instance of that class, so multiple threads can call the function with different arguments.
Note: the code itself is far from production ready, do not use this!
jaccomo 3 days ago [-]
Author here: Jactl is a secure embeddable scripting language that compiles to bytecode and supports Java 8 and later versions. The article describes how Continuations were used to provide Virtual Thread-like behaviour for scripts.
Blocking operations suspend a script which is then resumed from where it left off once the operation completes.
arunix 9 hours ago [-]
On the front page, there is an example about optional typing, but it's not very clear how the typing is coming in:
def fib(x) { x <= 2 ? 1 : fib(x - 1) + fib(x - 2) }
println "40th fibonacci number is ${fib(40)}"
marcolinux 15 hours ago [-]
TIL about jactl!
Just reading the site right now.
Many thanks for: no colored function (no async/wait) !
Any tips on using with gui/swing? rendering images/simple html, that would be awesome!
And what about (gasp) JSP? Or any other templating?
It is old school, yeah but I like jsp include (with params) and jsp 'web components' (tags).
Anyway, thanks for writing jactl!
sriram_malhar 10 hours ago [-]
Ah, I had virtual threads in Java 8 back in the day. I believe it still works.
But I believe the author moved to a Big Corp which sells databases, working on some big project which took all his time...
geodel 8 hours ago [-]
LOL, the person you are talking about is Project lead for Loom in OpenJDK.
arvyy 11 hours ago [-]
As a related work regarding continuations, there was also a thesis by Andrea Bernardini (https://andrebask.github.io/thesis), with similar principal idea
_old_dude_ 16 hours ago [-]
Nice article.
I think this is similar to the way Kotlin implements coroutine.
I believe Kotlin goes to the extra miles to also capture parts of the stack frames when creating the Continuation object so even when the runtime resume the continuation, the exceptions thrown later get the "correct" stack trace (not the one that shows that you come from a call through a MethodHandle).
Note: the code itself is far from production ready, do not use this!
Any tips on using with gui/swing? rendering images/simple html, that would be awesome!
And what about (gasp) JSP? Or any other templating? It is old school, yeah but I like jsp include (with params) and jsp 'web components' (tags).
Anyway, thanks for writing jactl!
Check Kilim: https://github.com/kilim/kilim
https://docs.paralleluniverse.co/quasar/
But I believe the author moved to a Big Corp which sells databases, working on some big project which took all his time...
I think this is similar to the way Kotlin implements coroutine.
I believe Kotlin goes to the extra miles to also capture parts of the stack frames when creating the Continuation object so even when the runtime resume the continuation, the exceptions thrown later get the "correct" stack trace (not the one that shows that you come from a call through a MethodHandle).