Friday, October 05, 2007

More Scripting

I am sure everyone has their own opinion about scripting inside of Croquet. Here are mine:

- The scripting we use should be a popular language. Javascript is the obvious choice. Lua gets high marks for coolness, but most people have never even heard of it. It would be great to include any language, but getting the first one to work is a big enough project.
- It needs to work INSIDE of the Island. That is, it should offer the exact same guarantees of determinism that Croquet Islands provide.
- It must utilize the same numerics package that we have added to Squeak/Croquet. (Otherwise the previous will fail.)
- It must be enhanced to support #future messages directly. You MUST NOT loop to simulate in Croquet. Bad bad bad.
- The interface for editing the scripting language must be INSIDE of the Island. In other words - extreme programming on steroids! Scripting is a form of communication. When we came up with the idea for Croquet the intent was not to have a virtual mall and hang out. It is intended to be a high bandwidth communication medium. This includes the ability to dynamically express a simulation as part of the conversation! Hence the expression itself is a part of the communication. The editing is part of the argument between the participants.

This is probably more important to me than others, but until this is available, it ain't Croquet.

9 comments:

kingless said...

Too bad about Lua, since it's my favorite scripting language. I do have to admit JS is better known.

Extreme Designer said...

Do you have a starting place for a javascript compiler written in Smalltalk? Here's link I googled up:
http://www.exept.de:8080/doc/online/english/programming/goody_javaScript.html

Is there something better?

David A. Smith said...

Thanks ED. This looks like an interesting project. I will definitatly give it a look.

Dave.Faught said...

What do you mean, in reference to the #future: method, by "you must not loop to simulate in Croquet"? Maybe an example would illustrate ...

Could the Jasmine-based Babel flavor of Javascript help here? It was quite limited as I recall.

Dave.Faught said...

What do you mean, in reference to the #future: method, by "you must not loop to simulate in Croquet"? Maybe an example would illustrate ...

David A. Smith said...

Animations/simulations occur over time. Looping like this:

myAnimation
[anything] whileTrue:[self animate]

is considered to be an atomic operation. That is, it must be completed in the same teatime. Further, there is no control on how fast this animation runs, hence even allowing it to suspend on occasion is not necessarily replicatable. There are ways to fix this, but I believe that is pointless. Far better to use the explicit and clean temporal tail recursion offered by #future:. The above becomes:

myAnimation
self animate.
anything ifTrue:[(self future:100)myAnimation.]

David A. Smith said...

The Babel stuff looked good, but unfortunately, it was not a full Javascript and I believe it diverged from the "official" standard in some very fundamental ways. How close to actual Javascript does it need to be? Would someone who was quite familiar with Javascript be turned off by something that was almost but not quite the same? How different is ActionScript from JavaScript?

patrickdlogan said...

Maybe something similar to douglas crockford's "simplified javascript" dialect. The full language has a lot of, em, bad stuff, including security holes.

David A. Smith said...

That is a very interesting idea Patrick. Thanks for the heads up. I will contact Doug!