Quite a long time ago I came across this page: http://riaone.com/products/deval/. Being in the thick of BoxCAD, I bookmarked it with the intent of exploring it later.
It’s been over a year now, since I first bookmarked it. Life interfered, see, so I haven’t done much of ANY programming for nearly a year. Anyway, I set myself, today, to the arduous task of learning something new.
D.eval is basically an AS3 interpreter that will run arbitrary code on the fly.
I was floored by the possibilities this offered. Obviously at the time, BoxCAD was on my mind, and so my initial excitement was so directed. Over time though, new possibilities made themselves evident. Basically, this API opens the door to limitless application extensibility. Using BoxCAD as my primary example, this API could allow end-users to add new, powerful functionality to the application, in a language they already know (my target audience in BoxCAD was AS3 developers).
Or, as in the swf below, it can serve as a very interactive tutorial tool. Go ahead… define functions, variables, loops, etc, and then run it. As you’ll note in the default code, variables are created and dynamically typed on the fly.
Now, for the really nifty thing, copy this in: removeChild(txtDevalOut);
txtDevalOut is simply the name of the output TextArea object. The base class extends sprite, so all sprite methods are available (i.e. removeChild, addChild, etc).
The way I set up D.eval in this little app is such that the context is that of the base class. So you have access to every property and function of the compiled class! The application can modify itself.
There are so many possibilities here. Mutating/Genetic code, dynamic loading of user-coded modules, scripting, etc.
Thanks to the folks at http://riaone.com. The simple app in this post is just a trivial example of the capabilities of the API.
Here’s the code. You’ll have to install the component (free) from the aforementioned website.






