Skip to content

Instantly share code, notes, and snippets.

@runarorama
Created December 13, 2011 20:30
Show Gist options
  • Save runarorama/1473744 to your computer and use it in GitHub Desktop.
Save runarorama/1473744 to your computer and use it in GitHub Desktop.

== Jumping on Trampolines ==

Trampolining is a practical everyday programming technique where a program is organized into discrete steps that can be executed independently. This can be used to avoid StackOverflowErrors in recursive programs, for stepping through code and adding breakpoints (without an IDE), cooperative multitasking, and even limited detection of infinite loops. We will discuss how to extend this technique for turning any call whatsoever into a tail call, and how to generalize trampolines to yield advanced techniques "for free"--Techniques like coroutines, "iteratees", polymorphic effect systems, and a solution to the infamous Expression Problem.

== Simulating Effect Polymorphism With Higher-Kinded Types ==

An effect system helps us specify the side-effects of a program in a machine-verifiable way. We discuss a straightforward method of using Scala's higher-kinded types to write effect specifications. Methods can be polymorphic in the effect they may have, and the types can specify "regions", which are the parts of the program in which specific effects are allowed to occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment