Extension vs. Change

Stephan Diehl (diehl@cs.uni-sb.de)
Thu, 22 May 1997 14:44:41 +0200

Both Sungwoo and Jean-Francis raised the question
whether we are going to extend or change the language.
I lend towards extensions which can be implemented
using Script nodes and maybe the EAI. This way our
extensions are portable.

I think, that it is no problem to implement
constraints on top of VRML 2.0.
I looked into the EAI, but couldn't find a way to
install an action, such that it would be called
anytime a value is changed.

But that's not really a problem. There are
two cases, when a value is changed:

1) by an event
2) in a program (Script or from an Applet via EAI)

In the first case we can use the eventsProcessed()
method, in the later we can expect the programmer
to call a function of ours like invalidate_constraints().

Jean-Francis also reminded me that in the
path syntax suggested there have been no function
calls, so we have to come up with a syntax
for function calls and how to define
functions.

So here is the new syntax for paths:
<path> ::= SELF.<simplepath>
| SUPER.<simplepath>
<simplepath> ::= <fieldname> | <eventname>
| <fieldname>.<simplepath>
| <eventname>.<simplepath>
| <functionname>(<path>*)

A function can be implemented as an event
connected to a Script node. But we wouldn't
want the programmer to define it this
way, so we need a better syntax. Here is
a first shot:

CLASS Tree [ SFNode right NULL
SFNode left NULL ]
{ Transform { children [ right left ] }
}

FUN SFNode rightmost( Tree node )
{ Tree tmp=node;
while (tmp.right!=NULL)
{ tmp=tmp.right;
}
return tmp;
}

DEF X ...
DEF Y ...

ROUTE rightmost(X).timer.value_changed
TO rightmost(Y).interpolator.set_fraction

I suggest a keyword FUN to define functions.
In a function definition the result type of
the function must be explicit. Local variables
can be defined using our improved type
systems. For the rest of the body of the function
defintion we use JavaScript (or VrmlScript).

Again, I expect that the above extensions can
be converted by a preprocessor into VRML 2.0.
And that the constraint solver can be written
in Java or JavaScript (which would be
probably to slow) and be included into the
code produced by the preprocessor.

Cheers
-- Stephan

---------------------------------------------------------------
Dr. Stephan Diehl Tel.: ++49-681/302-3915
EMAIL: diehl@cs.uni-sb.de WWW: http://www.rw.cdl.uni-saarland.de/private/diehl
---------------------------------------------------------------
There is no place like $HOME
---------------------------------------------------------------