Peter Amstutz | 19 Feb 06:11

templates/macros

Here's a quick brain dump of something I'm working on.  The specific 
goal is deal with the problem of parameterized types.  In this example, 
I show how one might define UInt8DynamicArrayProperty as a Property 
holding a DynamicArray of UInt8.

The idea is to set up "Template" vobjects which have TemplateParameters 
which are stand-ins for links other objects and are substituted when you 
actually create a template instance.  The "TemplateInstance" vobject 
links to the template and some set of parameters, and will have an 
"instantiate" method on it which produces a vobject structure with the 
appropriate parameter substitution.

Nothing coded yet, so this will likely change.  Incidentally, this is 
actually fairly similar to the template system coded for the original 
hypervos (which runs parts of interreality.org) so this idea of 
generalized subtree substitution is likely to be useful beyond the 
specific problem I'm trying to solve.

<vobject name="Property" type="/vos/core/Template">
  <vobject name="produces" linkTo="/vos/core/Class" />

  <vobject name="propertyType" type="/vos/core/TemplateParameter" />

  <child name="extends" type="/vos/core/Component" />

  <vobject name="value" type="/vos/core/Member">
    <child name="param" linkTo="../../propertyType" />
  </vobject>
</vobject>

(Continue reading)

Reed Hedges | 1 Mar 20:14

Re: templates/macros

Peter Amstutz wrote:

> The idea is to set up "Template" vobjects which have TemplateParameters 
> which are stand-ins for links other objects and are substituted when you 
> actually create a template instance.  The "TemplateInstance" vobject 
> links to the template and some set of parameters, and will have an 
> "instantiate" method on it which produces a vobject structure with the 
> appropriate parameter substitution.

This is definitely something we need.  It ought to be very 
straightforward to implement as a component type, using listeners.

But let's not add any more tasks like this right now, let's get the VOS 
core working first (including listeners)

Reed
Peter Amstutz | 3 Mar 23:40

Re: templates/macros

I went ahead and did it already, actually.  I needed the template functionality in the core so 
that I could specify VOS classes that are logically templates, such as UInt8DynamicArrayProperty 
(which is a property holding an array of bytes).  Without a template feature, I would have to do 
a lot of cut and paste to get DynamicStringArrayProperty, DynamicVector3ArrayProperty, etc...

The current scheme is somewhat incomplete though, we will need listeners to be able to properly 
propagate changes in the base template to all the template instances.

On Sat, Mar 01, 2008 at 02:14:00PM -0500, Reed Hedges wrote:
> Peter Amstutz wrote:
> 
> > The idea is to set up "Template" vobjects which have TemplateParameters 
> > which are stand-ins for links other objects and are substituted when you 
> > actually create a template instance.  The "TemplateInstance" vobject 
> > links to the template and some set of parameters, and will have an 
> > "instantiate" method on it which produces a vobject structure with the 
> > appropriate parameter substitution.
> 
> 
> This is definitely something we need.  It ought to be very 
> straightforward to implement as a component type, using listeners.
> 
> But let's not add any more tasks like this right now, let's get the VOS 
> core working first (including listeners)
> 
> Reed
> 
> 
> _______________________________________________
> vos-d mailing list
(Continue reading)


Gmane