[Haskell] Global Variables and IO initializers: A proposal and semantics

Greg Buchholz haskell at sleepingsquirrel.org
Tue Oct 12 19:04:55 EDT 2004


John Meacham wrote:
> 
> I have put some thought, some time ago, into the  'global
> initializers' problem in haskell but for various reasons never wrote
> up my conclusions.

    I'm not really qualified to answer, but does anyone think that this
paper might have a solution? 

    http://www.eecs.harvard.edu/~ccshan/prepose/prepose.pdf

   "The configurations problem is to propagate run-time preferences
throughout a program, allowing multiple concurrent configuration sets to
coexist safely under statically guaranteed separation.  This problem is
common in all software systems, but particularly acute in Haskell, where
currently the most popular solution relies on unsafe operations and
compiler pragmas.

    We solve the configurations problem in Haskell using only stable and
widely implemented language features like the type-class system.  In our
approach, a term expression can refer to run-time configuration
parameters as if they were compile-time constants in global scope.
Besides supporting such intuitive term notation and statically
guaranteeing separation, our solution also helps improve the program's
performance by transparently dispatching to specialized code at
run-time.  We can propagate any type of configuration data---numbers,
strings, IO actions, polymorphic functions, closures, and abstract
data types.  No previous approach to propagating configurations
implicitly in any language provides the same static separation
guarantees."



Greg Buchholz


More information about the Haskell mailing list