2.5 Contexts

/ E  An instance of the ShContext type encapsulates information relevant to the current execution state of Sh. This includes information about which programs are currently bound as well as some global settings, such as the current optimization level.

The current ShContext can be obtained by calling the static member function ShContext::current(). The initialization function shInit constructs the first context and activates it.

The optimization level under a particular context may be set using the optimization(int) member function. A value of zero is taken to mean that no optimizations at all should be performed, and any higher number adds additional optimizations. The default value is two, which implies that a reasonable “safe” set of optimizations should be performed. More experimental optimizations may be enabled by setting this to a higher number.


Note: This manual is available as a bound book from AK Peters, including better formatting, in-depth examples, and about 200 pages not available on-line.