From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id AC1C3BDCB for ; Sun, 4 Sep 2005 15:54:57 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j84DsvNR019650 for ; Sun, 4 Sep 2005 15:54:57 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA03308 for ; Sun, 4 Sep 2005 15:54:56 +0200 (MET DST) Received: from furbychan.cocan.org (furbychan.cocan.org [80.68.91.176]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j84Dstpt002324 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sun, 4 Sep 2005 15:54:56 +0200 Received: from rich by furbychan.cocan.org with local (Exim 3.35 #1 (Debian)) id 1EBvAU-0006HF-00 for ; Sun, 04 Sep 2005 15:08:22 +0100 Date: Sun, 4 Sep 2005 15:08:22 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] Re: Feeding the OCaml GUI troll Message-ID: <20050904140813.GB18166@furbychan.cocan.org> References: <20050830174757.99765.qmail@web30510.mail.mud.yahoo.com> <200508302001.58080.jon@ffconsultancy.com> <3d13dcfc05083101487092acd5@mail.gmail.com> <43168841.9000302@havenrock.com> <1125580528.7192.23.camel@localhost.localdomain> <1125646841.735.57.camel@acerf.exomi.com> <1125664781.7262.51.camel@localhost.localdomain> <1A0BFF96-D811-4173-933F-F7BB69668856@m4x.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1A0BFF96-D811-4173-933F-F7BB69668856@m4x.org> User-Agent: Mutt/1.3.28i From: Richard Jones X-Miltered: at nez-perce with ID 431AFCB1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 431AFCAF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 repetitive:01 mli:01 mli:01 val:01 val:01 bool:01 bool:01 notepad:01 int:01 int:01 widgets:01 exp:02 exp:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 We face a similar problem, connecting database fields to GUI widgets. We came up with a concept of a "tied reference" variable. Included below is the interface - you can probably work out how it works. It has to be said that it wasn't particularly successful, and still required lots of manual and repetitive work to make it happen. Luckily we ditched that project for financial reasons :-) Rich. ------------------------------------------------------------ tiedref.mli (* Tied references. * Copyright (C) 2003 Merjis Ltd. * $Id: tiedref.mli,v 1.2 2003/12/02 13:22:01 rich Exp $ *) type 'a tiedref val tiedref : read:(unit -> 'a) -> write:('a -> unit) -> 'a tiedref val ( !* ) : 'a tiedref -> 'a val ( *:= ) : 'a tiedref -> 'a -> unit ------------------------------------------------------------ dbtiedref.mli (* Database-backed tied references. * Copyright (C) 2003 Merjis Ltd. * $Id: dbtiedref.mli,v 1.3 2004/03/08 13:44:25 rich Exp $ *) open Tiedref type dbrow val dbrow : Dbi.connection -> string -> string -> Dbi.sql_t list -> dbrow type 'a dbfield val dbfield_bool_not_null : string -> bool dbfield val dbfield_bool : string -> bool option dbfield val dbfield_int_not_null : string -> int dbfield val dbfield_int : string -> int option dbfield val dbfield_string_not_null : string -> string dbfield val dbfield_string : string -> string option dbfield val dbtiedref : dbrow -> 'a dbfield -> 'a tiedref -- Richard Jones, CTO Merjis Ltd. Merjis - web marketing and technology - http://merjis.com Team Notepad - intranets and extranets for business - http://team-notepad.com