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 CB4A3BB81 for ; Sat, 18 Dec 2004 15:28:11 +0100 (CET) Received: from mta08-winn.mailhost.ntl.com (mailhost.ntl.com [212.250.162.8]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBIESBlN007825 for ; Sat, 18 Dec 2004 15:28:11 +0100 Received: from aamta03-winn.mailhost.ntl.com ([212.250.162.8]) by mta08-winn.mailhost.ntl.com with ESMTP id <20041218142811.RWCR15658.mta08-winn.mailhost.ntl.com@aamta03-winn.mailhost.ntl.com>; Sat, 18 Dec 2004 14:28:11 +0000 Received: from [80.4.70.84] by aamta03-winn.mailhost.ntl.com with ESMTP id <20041218142811.HIVM9818.aamta03-winn.mailhost.ntl.com@[80.4.70.84]>; Sat, 18 Dec 2004 14:28:11 +0000 Message-ID: <41C43E79.1040502@ntlworld.com> Date: Sat, 18 Dec 2004 14:28:09 +0000 From: "chris.danx" User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Type problem... possible design problem References: <41C37CF7.5050400@ntlworld.com> <200412180807.05925.jon@jdh30.plus.com> In-Reply-To: <200412180807.05925.jon@jdh30.plus.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 41C43E7B.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 wrote:01 wrote:01 nodes:01 nodes:01 o'caml:01 closures:01 variants:01 subgraphs:01 ntlworld:98 ...:98 lights:98 node:01 arbitrary:01 graph:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=1.4 required=5.0 tests=DNS_FROM_RFC_POST autolearn=disabled version=3.0.0 X-Spam-Level: * Jon Harrop wrote: > On Saturday 18 December 2004 00:42, chris.danx wrote: > >>What is the solution to the following problem? There are two types of >>object in a scene graph, those that may have children and those may not. >> A leaf may not have children. > > > Could you redefine this as "There is one type of node in a scenegraph, which > has an arbitrary number of children"? Leaf nodes are then nodes with zero > children. I could. The problem was that I wanted to enforce that leaf nodes are the only renderable objects and internal nodes are for grouping and state changes - lights, transformations, etc. >>I've not programmed in O'Caml for a while and am not yet fully >>comfortable with ocamls object system anyway, so I may be being silly. >>Can anyone shed some light on a solution to this? > > Why are you using OO? Can you do what you want with modules and variant types > more easily? I was using OO because I want to extend the nodes available. I suppose I can use closures. My concern with variants is sharing subgraphs in graphs, will they be shared or copied?