Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Skinnable windowing system in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Prevost <jprevost@l...>
Subject: Re: [Caml-list] Skinnable windowing system in OCaml
On Wed, Jan 09, 2002 at 05:41:21PM -0800, Walter B. Rader wrote:

>I want the end user to be able to configure the "look-and-feel" of the
>windowing system at runtime, and I'm not sure the best way to go about
>doing this.  Currently, the window manager calls upon a class called
>"decorator" that performs the window decorations (title bar, frame, etc.)
>The decorator class could be sub-classed (or perhasp redefined?) to
>change the behavior.

I've thought about this in the past.  Here's the way you want to
approach things for dynamic loading, with or without objects.  (You
could also use a record of functions for this, most likely.)

When a module loads, everything in it executes to define various
functions and also to have side effects.  It is impossible, however,
to try to refer to symbols from the namespace of a module you're
loading.  If you refer to the symbol, the module must already have
been loaded before your referring module is loaded (static scope.)

What you should do is have your main code for the engine provide
a well known set of hashtables or lists or the like which are
mutable and can be updated by modules that are loaded later, possibly
by calling functions in your API.  Whenever a new "skin" loads, it
adds itself to the registry of skins in this manner.  Then the
engine may access the new code by looking up the functions/objects/etc.
from the registry.

This does not provide a way to "unload" old modules.  It does,
however, allow you to load more modules as time goes on, or load
one module at startup, or whatever you'd like.

Bug reports:  FAQ:
To unsubscribe, mail  Archives: