next up previous index
Next: Utilities Up: Miscellaneous Previous: Reflection   Index

Application hooks

In app.diesel:

extend module Stdlib;
module App;
The generic_app object is a place for libraries to put default behavior that can be customized by individual applications.

object generic_app;
The app variable is what libraries should refer to to get the current application object. Individual applications (and optional libraries too) should define children of generic_app that override the behavior of generic_app, and update the app variable to hold that object. Since the app variable's type is just generic_app, only generic operations are allowed on app. For client-specific operations, the client-specific objects should be referred to directly (or the client-specific operations should have appropriate default behavior introduced on generic_app, and then overridden by the client-specific operations).

let var app:generic_app;
For programs that have multiple ``applications'', e.g. the compiler which has two different versions of the typechecker ``application'', the using_app control structure can be used to temporarily switch to a particular application object during evaluation of a block of code.

fun using_app(new_app:generic_app, cl:&():`T):T;
end module App;


next up previous index
Next: Utilities Up: Miscellaneous Previous: Reflection   Index

Cecil/Vortex Project