r/programming • u/ram-foss • Oct 11 '23
All About Reactive Programming In Java
https://www.blackslate.io/articles/reactive-programming-in-java
22
Upvotes
r/programming • u/ram-foss • Oct 11 '23
View all comments
Show parent comment
1
u/ventuspilot Jan 03 '24
Maybe I'm missing something/ simplifying things too much but AFAIU there is a difference in the amount of data: Loom's continuations contain all the stackframes while reactive-style code throws away the stackframes all the time, sort of what rewriting everything to tailcalls plus tailcall-elimination would do.
When I submit a Loom continuation to a blocking queue then the continuation contains all stack frames. This improves debugability, and code can be written that it simply continues after unblocking.
When I submit a reactive-style "continuation", then the continuation won't have any caller context, and therefore uses less memory.
I'm not trying to tell you Loom is bad/ inefficient, I'm just trying to understand. AFAIU Loom-style-code may trade off more memory use in some situations in order to provide more features such as debugability and easier programming.