Commit Graph

3 Commits

Author SHA1 Message Date
Bob Nystrom
f1fd125385 feat: allow yielding main fiber and expose current fiber reference
- Change Fiber.yield() to exit interpreter when no parent fiber exists instead of raising runtime error
- Add Fiber.current primitive to return the currently executing fiber object
- Update interpreter loop to stop execution when PRIM_RUN_FIBER receives null value
- Modify test expectations to reflect new yielding behavior from main fiber
2015-03-07 20:32:11 +00:00
Bob Nystrom
5382fa05d7 feat: allow empty argument list methods in calls, definitions, and docs
- Compile empty `()` as a valid method signature distinct from no parentheses
- Update `call()`, `clear()`, `run()`, `try()`, and `yield()` to use empty argument lists
- Revise documentation across multiple files to reflect new signature semantics
2015-02-27 07:08:36 +00:00
Bob Nystrom
10b19d969b feat: implement symmetric coroutines with fiber.call and fiber.run distinction
Add new `fiber.call` method that remembers the calling fiber for symmetric transfer, while `fiber.run` now performs tail-call style switching without preserving the caller. Introduce re-entrancy guards preventing a fiber from being called multiple times, update all test fixtures to use the new API, and add comprehensive test coverage for call semantics including direct/indirect re-entrancy, value passing, and finished fiber errors.
2014-04-14 14:23:05 +00:00