[Pipet Users] Command Compilation in Piper: A Discourse

Jean-Marc Valin jmvalin at locusdialogue.com
Tue Feb 13 16:02:31 EST 2001


> I agree with you that we need to have a very small number of *STANDARD* node
> types.  For example, in most programming languages you will have types
> INTEGER, REAL, CHAR, STRING, etc., just a few.  *BUT* (and that's a big but)
> you can create new types using "old" types.
> 
> Take Pascal for example.  You can define...
> 
> TYPE
>     MYNUMBER : INTEGER;
>     MYARRAY : ARRAR[0..100] OF TYPE MYNUMBER;
> 
> (or whatever -- I can't remember my Pascal at the moment ;-))
> 
> But, I have created my own type! :-)
> 
> I'm not saying that Overflow/Piper should have types "flag" and "filename"
> as standard types, but that they can be created using existing types and
> then packaged (compiled) into a subnet.  The subnet can then be called
> "flag" or "filename".  Make sense? :-)
> 
> This is the same concept as defining new methods, procedures, functions,
> objects, whatever.  I should be doable in Piper.

Wait a minute, I think there is some confusion about types here. In
Overflow, there is "Data type" and "Node type". The Data types are Int,
Float, Vector, ... The Node types are Constant, Add, Load, Save, ...
(BTW, a Constant node is like a Node that always returns the same
object/value)

The data types are equivalent to the C types (int, float, ...), while
the node types are equivalent to different C functions. If you want to
add a new Node type, all you need to to is add the .cc (implementation)
to the the Makefile, or write a new .n (subnet).

You can also add new types, but it needs to be coded in C++. Right now, 
there's no equivalent of subnets for Data types. It's on my TODO list
though (but far from the top). 

For everything I've written type=="Data type" (not Node type). I hope
this clarifies a few things.

Although you can add new data types as you wish, I really do not
recommend doing so for things like "flag", "filename", as it doesn't add
any functionality, but forces you to implement all the operators for
those types (and things like add(flag, filename), add(string, filename))

	Jean-Marc




More information about the Pipet-Users mailing list