Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "chris.danx" <chris.danx@ntlworld.com>
To: Jon Harrop <jon@jdh30.plus.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Type problem... possible design problem
Date: Sat, 18 Dec 2004 14:28:09 +0000	[thread overview]
Message-ID: <41C43E79.1040502@ntlworld.com> (raw)
In-Reply-To: <200412180807.05925.jon@jdh30.plus.com>

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?



  reply	other threads:[~2004-12-18 14:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-18  0:42 chris.danx
2004-12-18  4:00 ` [Caml-list] " Matt Gushee
2004-12-18  8:07 ` Jon Harrop
2004-12-18 14:28   ` chris.danx [this message]
2004-12-18 15:27     ` Richard Jones
2004-12-18 20:06       ` chris.danx
2004-12-18 18:37     ` Jon Harrop
2004-12-20 11:50     ` skaller

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=41C43E79.1040502@ntlworld.com \
    --to=chris.danx@ntlworld.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=jon@jdh30.plus.com \
    /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