Phos: Drag and Drop Method Calls

So I did a small demo video of some of the new features in Phos that demonstrate some good old ideas from Randy Smith's work from around 1986. David Ungar gave a talk at Stanford where is explained a number of the concepts in Randy's Alternate Reality Kit. Anyways see what you can catch here:

  1. Load a remote object from the server using the Inventory

  2. Run that object's display() method

  3. Inspect the object by right click

  4. Modify the object by dropping a Block onto the message property

  5. Create new circle object

  6. Invoke the color(0,255,0) method of the Circle

  7. Invoke the radius(50) method of the Circle

  8. Add a down method by dropping the block onto the Circle's mirror object

  9. Drop a function that when we press a mouse button down on the circle it displays an Alert

  10. Change the method by dropping a new Block function that uses the Circle's message property

  11. Drop a message Block onto the Circle's mirror to add a message property

  12. Dropped a 'You Clicked a Circle!' Block onto the message property to set its value

  13. Added a up method that changed the circle's color to red when the mouse button raised over the Circle

  14. Invoked the radius message using the target's own radius that.rad + 10 to increment by 10

  15. Notice how the mirror's property values change as the Circle grows

  16. Since the Block get stuck over the circle, we send it an at(300,300) message to set its location

  17. We then shrink it using radius(that.rad - 20)

  18. To demonstrate how one can do animations, we repeatedly send the to(30,30) to move it 30 right, 30 down

  19. Notice how the x and y properties increment as we send messages!

What you get for 1kloc

Currently, the base system with support for 3 browsers consists of 932 lines of javascript. Most of this code is in the 21 core objects. There are 37 objects in the current system, many of which are used for building out typical parts of standard applications. Currently the entire environment is being built in itself, and is boot strapped on 236 lines of javascript. With a little effort this could be reduced to about 60ish.

The Next Generation Backend

The current backend server is a 40 line Plack server app that I run on Starman. The backend is going to get some love and have a few nice features: