Smalltalk-80 also provides computational reflection, the ability to observe the computational state of the system. In languages derived from the original Smalltalk-80 the current activation of a method is accessible as an object named via a pseudo-variable (one of the six reserved words), thisContext, which corresponds to a stack frame in conventional language implementations, and is called a "context". Sending a message is done within some context, and to evaluate the message another context is created, the first being the sender of the former. In this way the stack is a linked list of context objects, and the debugger is essentially an inspector of this "spaghetti stack". By sending messages to thisContext a method activation can ask questions like "who sent this message to me". These facilities make it possible to implement coroutines or Prolog-like back-tracking without modifying the virtual machine. The exception system is implemented using this facility. One of the more interesting uses of this is in the Seaside web framework which relieves the programmer of dealing with the complexity of a Web Browser's back button by storing continuations for each edited page and switching between them as the user navigates a web site. Programming the web server using Seaside can then be done using a more conventional programming style. As with message sending Smalltalk-80 virtual machines optimize away the expensive use of contexts internally, providing the illusion and flexibility of a spaghetti stack without most its costs. Essentially context objects are created lazily as required, for example when a message is sent to the thisContext variable.
Smalltalk-80 also provides computational reflection, the ability to observe the computational state of the system. In languages derived from the original Smalltalk-80 the current activation of a method is accessible as an object named via a pseudo-variable (one of the six reserved words), thisContext, which corresponds to a stack frame in conventional language implementations, and is called a "context" Sending a message is done within some context, and to evaluate the message another context is created, the first being the sender of the former. In this way the stack is a linked list of context objects, and the debugger is essentially an inspector of this "spaghetti stack". By se.nding messages to thisContext a method activation can ask questions like "who sent this message to me". These facilities make it possible to implement coroutines or Prolog-like back-tracking without modifying the virtual machine. The exception system is implemented using this facility. One of the more interesting uses of this is in the Seaside web framework which relieves the programmer of dealing with the complexity of a Web Browser's back button by storing continuations for each edited page and switching between them as the user navigates a web site. Programming the web server using Seaside can then be done using a more conventional programming style. As with message sending Smalltalk-80 virtual machines optimize away the expensive use of contexts internally, providing the illusion and flexibility of a spaghetti stack without most its costs. Essentially context objects are created lazily as required, for example when a message is sent to the thisContext variable.