caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Prevost <jprevost@libcom.com>
To: "Walter B. Rader" <wrader@OCF.Berkeley.EDU>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Skinnable windowing system in OCaml
Date: Thu, 10 Jan 2002 18:14:53 -0500	[thread overview]
Message-ID: <20020110181453.A94969@libcom.com> (raw)
In-Reply-To: <Pine.SOL.4.44.0201091729100.18807-100000@apocalypse.OCF.Berkeley.EDU>

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.

John.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


      reply	other threads:[~2002-01-11  9:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-10  1:41 Walter B. Rader
2002-01-10 23:14 ` John Prevost [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020110181453.A94969@libcom.com \
    --to=jprevost@libcom.com \
    --cc=caml-list@inria.fr \
    --cc=wrader@OCF.Berkeley.EDU \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).