[vos-d] scripting thoughts

Peter Amstutz tetron at interreality.org
Tue May 2 11:10:43 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ok, Lalo and I have been discussing and brainstorming where we want to go 
with scripting in VOS.  There seem to be a couple of different possible 
approaches.

The first option is to continue what we have now, which is binding the 
C++ API into a target language (Python).  This is useful if you want to 
write a VOS program in pure Python, however it doesn't help that much with 
embedding, where you need to be able to load and initialize script 
fragments from C++.  Also Python cannot really be sandboxed, so Python 
would only be useful on the server side.

The second option, which is what we are leaning towards, is to ignore 
Python for now and go directly to using Javascript (using Spidermonkey). 
This is more interesting because not only would it allow server side 
scripting, it opens the door for client side scripting.  The fact that 
several other libraries we are looking to intergrate with (OpenVRML, AWS2) 
use Spidermonkey also helps.  Javascript is really the only language that 
I know of that has a proven track record of being resistant to attacks (of 
all sorts), is easily sandboxed, and can partition different parts of the 
runtime into different contexts with different levels of security.

However, what we would really like to do is just solve the scripting 
problem once.  If we can put the right infrastructure in place, then new 
languages can be added relatively easily by plugging into that 
infrastructure.

The idea I have been turning over in my head for a while is that 
cross-language marshalling is really not very different from passing 
messages over the network, and we already HAVE a message passing system. 
Why not just have the client scripting language use the VOS message API to 
access the site?  This would be mean that *every* VOS call outside of C++ 
would run over the messaging system.  It would be a bit less efficient 
than SWIG bindings (not by much?) but it would probably be good enough.

This would mean a few changes in VOS.  We could introduce a lightweight C 
API that basically only covered sending and receiving messages, and then 
the scripting bindings would be a relatively easy matter of connecting to 
the lightweight API, and recreating the VOS API in a way suitable to the 
target language.  If we come up with an interface language (Object Type 
Definition) then we could even generate those APIs automatically.  The 
data types passable via this interface would be the same as the Property 
datatypes I proposed earlier.  This would have the useful side effect of 
finally documenting the various VOS message protocols as well :-)

At this point you could probably make a case that we've reinvented CORBA 
or *COM, so if anyone with more experience with these technologies can 
compare and contrast, I would be very interested to hear :-)

An interesting side note is that since the interface was originally 
designed for high-latency networks, various mechanisms already exist to 
batch up requests across the message layer.  Something to think about.

If this sounds like the way to go, then we need to discuss exactly what 
infrastructure changes we need in VOS to be able to support scripts this 
way.

[   Peter Amstutz   ][ tetron at interreality.org ][ piamstutz at anteon.com  ]
[Lead Programmer][Interreality Project][Virtual Reality for the Internet]
[ VOS: Next Generation Internet Communication][ http://interreality.org ]
[ http://interreality.org/~tetron ][ pgpkey:  pgpkeys.mit.edu  18C21DF7 ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFEV3Z3aeHUyhjCHfcRAkL5AJ9Fub2Udolg3HzMX6lN/bW2Y3D5gACdFFft
G0lgjghQ5xjXLeOfj/2Pis0=
=xR6I
-----END PGP SIGNATURE-----




More information about the vos-d mailing list