Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Scala: The Ideal Language for Game Wallets

Michał Bednarz
January 11, 2024
6

Scala: The Ideal Language for Game Wallets

Michał Bednarz

January 11, 2024
Tweet

Transcript

  1. mutating shared state I/O throwing exceptions FP: no side effects

    Side effect: when function relies on or modified something outside its parameters.
  2. composable testable easy to reason about FP: pure functions Pure

    function: function that doesn't perform side effects.
  3. Multiple runtimes JVM: most widely-used runtime for Scala Scala Native:

    faster start-up time, lower memory footprint JavaScript: for Scala.js
  4. Scala on JVM inter-op with java libraries existing performance tools

    VisualVM, JConsole, etc. can interact with java sources
  5. Scala is scalable effect systems & fibers akka & actors

    functional concurrency operators & primitives
  6. Effect systems Effect systems are used in functional programming to

    manage side effects. They help to manage unpredictable program parts such as mutating shared state, I/O. In scala most popular effect systems are cats-effect and ZIO. Besides that - effect systems come with runtime for managing concurrency. cats-effect runtime provides thread pool for: computation tasks blocking operations
  7. Fibers Fibers are extremely lightweight threads. In JVM runtime -

    they run on top of JVM threads. Based on cooperative multitasking (instead of pre-emptive like e.g. OS) Semantically blocking (doesn't block underlying thread) Purely functional composition, timeouts, cancellation
  8. Fibers: parallel combinators we end up with 100 fibers just

    for the region enclosed within 'parTraverse': they're all in WAITING state and they're not blocking any real thread.