๐Ÿš€ Just dropped: #Kyo 0.14.0

New Features

kyo-data

  • Text: Optimized API for string manipulation that avoids copying the underlying char array.
  • Schedule: A new data type for representing complex scheduling.

kyo-prelude

  • Parse Effect: New effect with support for backtracking, lookahead, and cut operations. The Parse effect is implemented using Var to track parsing position and Choice to evaluate multiple possible branches. The API is designed to provide a more intuitive experience by using an imperative-like approach for consuming inputs and evaluating alternatives, rather than composing parsers with special operators. The effect also supports incremental parsing through integration with Stream in Parse.run.

kyo-core

  • Unsafe Queue and Channel: New protected Unsafe APIs added for both Queue and Channel.
  • Time Shift and Control: Clock introduces two new APIs:
    • Clock.withTimeControl: Enables manual time control
    • Clock.withTimeShift: Allows speeding up or slowing down computation execution based on a factor Additionally, Timer has been merged into Clock, ensuring both time control methods work with scheduled execution. For example: Clock.withTimeShift(factor = 2)(Clock.repeatWithDelay(2.seconds)(computation)) will schedule the computation every 1 second of wall-clock time, as the shift doubles the time passage speed.
  • Monotonic Clock: New Clock.nowMonotonic method provides results based on System.nanoTime for improved precision in time measurement. Clock.stopwatch has been updated to use this feature.
  • Isolated Locals: New functionality prevents Locals from being automatically inherited by forked fibers through Local.initIsolated. This mechanism provides fiber identity by ensuring isolated locals remain within a computationโ€™s scope.
  • Reentrant Meters: Mutexes, semaphores, and rate limiters are now reentrant by default, with customization options to disable reentrancy. This feature uses isolated locals to track meters acquired by a fiber.
  • Abort[Nothing] in Async: The Async effect now includes Abort[Nothing] by default to handle unexpected failures (panics in Kyoโ€™s terminology).

Other Changes

  • Timer functionality has been moved to Clock.repeat* methods.
  • Added a new recommended compiler flag to ensure proper handling of Kyo computations.
  • A bug was recently introduced in Async.timeout making interrupts not propagate correctly. This bug has been fixed and tests were added to ensure the feature works correctly with kyo-sttp.
3 Likes