renammed from generators to coroutines

This commit is contained in:
Parker TenBroeck 2026-05-13 08:22:27 -04:00
parent ac83bc6e93
commit c8f3b6c01f
18 changed files with 63 additions and 67 deletions

View file

@ -1,6 +1,6 @@
# Generators/Futures for Java 24+
# Coroutines for Java 24+
Futures/Generators implemented as state machines integrated into standard java.
Coroutines implemented as state machines integrated into standard java.
- Futures/Generators are lazy and only make progress when called upon
- Integrated as much as possible into java to work with the type system as much as possible
@ -150,16 +150,16 @@ This library requires the application be ran with a custom class loader as follo
```java
public static void main(String[] args) {
// loads the current class with a custom class loader and calls *this* method with the provided arguments.
// *this* method - the one used to call `runWithStateMachines`
RT.runWithStateMachines(StateMachineClassLoader.Config.builtin(), (Object) args);
// *this* method - the one used to call `runWithCoroutine`
RT.runWithCoroutine(CoroutineClassLoader.Config.builtin(), (Object) args);
// past this point generators will be created on methods which match the criteria
// past this point Coroutines will be created on methods which match the criteria
}
```
Once finished any class loaded will be scanned for methods which match a particular signature.
When matched a shim is introduced into the source method and a class is constructed which stores all state for the future/generator
When matched a shim is introduced into the source method and a class is constructed which stores all state for the coroutine
A basic example here where we have some parameters
```java