Angel \”Java\” Lopez on Blog

October 20, 2010

Working on AjTalk, Smalltalk-like VM written in C#

Filed under: .NET, AjTalk, Programming Languages, Smalltalk — ajlopez @ 8:25 pm

These days, I’m working in my pet project AjTalk, an Smalltalk-like VM written in C#. Past year, I wrote some post about the project. It’s time to refresh the status of the project: it can manage many VM is one .NET process, has agents, parallel processing, distributed objects, and access to .NET class library. This post is an intro to its base types.

You can download the source code (Work in progress) from:

http://code.google.com/p/ajtalk/

The current aspect of the solution (written using Visual Studio 2008):

The core library is AjTalk, and all its code was written using TDD. The tests are in AjTalk.Tests project.

AjTalk is prepared to manage its own kind of objects, that implements IObject interface:

and it can manage .NET native types and objects, too. Strings, integers, and numbers are created and managed as .NET native objects. I should write a dedicated post about the current implementation to create and access these native objects.

The main implementation of IObject is BaseObject. Internally, it keeps a reference to an IBehavior object and an internal array of instance variables:

    [Serializable]
    public class BaseObject : IObject, ISerializable
    {
        private IBehavior behavior;
        private object[] variables;
        public BaseObject()
        {
            this.behavior = null;
            this.variables = null;
        }
        public BaseObject(IBehavior behavior, int nvars)
        {
            this.behavior = behavior;
            this.variables = new object[nvars];
        }
//...
    }

Note that the instances variables are not instances of IObject: they are objects, so they can reference any native .NET objects or AjTalk IObjects. I had plans to access native objects via a decorator that implements IObject, but I decided to reference them directly.

IBehavior is defined as:

Its main responsibility is to define and retrieve methods by name, create objects, and keep the superclass hierarchy. The methods are implementation of IMethod, derived from IBlock:

Currently, all these interfaces are implemented using native classes. In this way, I can use it without having an AjTalk class library written in the same language. It’s a sort of scaffolding: a way to have an initial base to build over the rest of the language.

201 tests, all green:

Good code coverage, I could improve the number:

Next topics to explore: Machine implementation, Blocks, access to .NET types and objects, agents, distributed objects, and transactional objects (Work in progress).

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

2 Comments »

  1. Peter Fisk wrote smalltalk in silverlight 1.1 a long time ago.
    The blog is gone unfortunately. I found some archived stuff.
    http://www.clubsmalltalk.org/web/index.php?view=newsfeed&catid=36%3Asmalltalkers&id=90-peter-fisk-&option=com_newsfeeds&Itemid=74

    You might want to try to track it down. It used the DLR.

    Comment by WillSmith — October 20, 2010 @ 9:52 pm

  2. Indeed is an interesting idea (at least to me as Smalltalker) any sort of Smalltalk experiment.

    I’m not able to follow this more than reading because I don’t use VStudio, but will continue reading the progress.

    Congrats!

    Comment by German Arduino — October 21, 2010 @ 9:38 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: