From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA09772; Fri, 11 Jan 2002 10:49:36 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA09704 for caml-list@pauillac.inria.fr; Fri, 11 Jan 2002 10:49:31 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA28193 for ; Fri, 11 Jan 2002 00:09:41 +0100 (MET) Received: from libcom.com ([208.167.88.73]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g0AN9eL10388 for ; Fri, 11 Jan 2002 00:09:40 +0100 (MET) Received: (from jprevost@localhost) by libcom.com (8.11.6/8.11.6) id g0ANEr395001; Thu, 10 Jan 2002 18:14:53 -0500 (EST) (envelope-from jprevost@libcom.com) Date: Thu, 10 Jan 2002 18:14:53 -0500 From: John Prevost To: "Walter B. Rader" Cc: caml-list@inria.fr Subject: Re: [Caml-list] Skinnable windowing system in OCaml Message-ID: <20020110181453.A94969@libcom.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.22.1i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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