3 ms·
One point of view of a trampoline is that you are implementing a small virtual machine (or, in the terminology of SICP and I believe the original Scheme paper,
by kmill 9y ago
One point of view of a trampoline is that you are implementing a small virtual machine (or, in the terminology of SICP and I believe the original Scheme paper, a "register machine") with two instructions: call and return. The virtual machine provides the programmer with a very controlled goto statement, known as a tail call.
The more general principal is that you can introduce small virtual machines to extend a language with features not present in the original one. In an extreme case, you can extend C with a virtual machine that implements all of Common Lisp. Much less extreme is an asynchronous event loop using generators. (A language isn't just its syntax.)