Angel \”Java\” Lopez on Blog

January 31, 2014

Smalltalk, JavaScript, NodeJs, C#, and Tutti Li Fiocci

Filed under: AjTalk, C Sharp, JavaScript, NodeJs, Smalltalk, Talks, Video — ajlopez @ 5:43 pm

Past year, I gave a talk at Smalltalks 2013, Rosario, Argentina. The conference was a great experience to me, and there were many interesting talks, implementations and ideas.

My talk was about implementing Smalltalk, in C#, and JavaScript. The main repos are: (I presented it at Smalltalks 2010) (I presented it at Smalltalks 2011)

My recorded talk:

The presentation:
More talks at

The first project is an interpreted based on byte codes, written in C#. It can compile to JavaScript, but the key features is to have a VM based on bytecodes, that have access to native .NET types and objects, remote execution, actors, and more. See my posts.

The second project is an implementation of Smalltalk but in JavaScript. Internally, it have a compiler to JavaScript, but also a compiler to bytecodes and then, an interpreted VM written in JavaScript. Both projects now supports NPM (Node.js package manager) for new modules.

In 2013, I added Node.js support and access to AjTalkJs, so I can run an Express application from Smalltalk:


Next experiments: distributed message. That is, an object in one machine sends a message to an object in a remote machine/process,  in a fire and forget way. I think Node.js ecosystem is a good plate to host such experiments. My previous work at Distributed Applications with Node.js. I want a distributed Smalltalk machine/application. Maybe, if the communication protocol is easy or pluggable, I could add clients/servers implemented in other Smalltalk dialects. But baby steps first ;-)

Keep tuned!

Angel “Java” Lopez

November 19, 2013

November 4, 2013

End Of Iteration 2013w44

Filed under: Smalltalk, JavaScript, AjTalk, Python, Open Source Projects, NodeJs, Iteration, RedPython — ajlopez @ 6:27 pm

Previous Post
Next Post

The main outcomes were: a talk, about my Smalltalk implementations, new sample code and a new project, inspired by Python and Smalltalk conference.

AjTalk Implementations

I reviewed and improved my implementations:

I added a sample using AjTalkJs, Node.js, Express.

My talk for Smalltalks 2013 at


I want to implement a compiler/transpiler from reduced (subset of) Python to C, at first using JavaScript.

The project:

I have two samples running: simple hello world, and

More ideas to implement this week. I should improve my Ruby in C# implementation, and maybe, write a Ruby implementation in JavaScript.

Keep tuned!

Angel “Java” Lopez

November 2, 2013

New Month’s Resolutions: November 2013

Time to review my October resolutions:

- Give a talk about PHP and Node.js [complete] see post and PHP/Node repo and PageJs repo at PHP Dev Argentina 2013
- Give a talk about TDD with ASP.NET MVC [complete] see repo
- Give a talk about Scala implementation [complete] see slides and simple samples
- Give a talk about Python in JavaScript [complete] see repo and slides at PyCon 2013 Argentina
- Give a talk about Smalltalk in JavaScript and C# [complete] see repo and slides at Smalltalks 2013

This new month’s resolution:

- Start compiler reduced Python to C, using JavaScript
- Give a talk about Ruby in C#
- Start Ruby to JavaScript compiler
- Complete variable scope in Mass language
- Give a talk about compiling languages to JavaScript (to be confirmed)
- Write web framework for AjTalkJs (to be used in Node.js) (plain? MVC?)
- Improve NPM modules in AjTalkJs and AjTalk
- Improve unit test support in AjTalkjs and AjTalk
- Improve match and data structure in AjErl

More fun is coming ;-)

Keep tuned!

Angel “Java” Lopez

October 28, 2013

End Of Iteration 2013w43

Previous Post
Next Post

The week was dedicated to prepare and give a talk, and prepare this week next talk.


My Python to JavaScript transpiler, written using JavaScript. It runs on node.js and browser.

It can use Node.js modules using import, and it can run Python scripts in the browser.

I gave a talk at PyCon Argentina 2013. My slides at:


My Smalltalk-like VM in bytecodes and JavaScript, written in JavaScript.

Now, I can use Node.js modules, run in server and browser. Example:

I was working in minor refactoring of:

And I was working on two non-public projects: one in C#, in-memory OLAP, and another one in Java, with agile team.

This week I will give a talk about my Smalltalk implementations at Smalltalks 2013 Argentina:

More fun is coming.

Keep tuned!

Angel “Java” Lopez

October 21, 2013

End Of Iteration 2013w42

Filed under: Smalltalk, JavaScript, AjTalk, Python, Open Source Projects, Iteration, JPyScript — ajlopez @ 2:22 pm

Previous Post
Next Post

The past week was dedicated to two non-public projects, and prepare of my next talks.


Inspired by a work by @darachennis  ( I wrote a simpler implementation of beams (piped message processors

I should write the, but the tests are self-explanatory. A beam receives messages and emit messages. It can have a filter function, filtering the message to process. And a transform function, that can emits new messages.


It compiles a Python-like language to JavaScript. The compiler is written in JavaScript

Notable, I can write controllers in Python for Express web apps. See samples


My Smalltalk VM in JavaScript. Using JavaScript, it compiles Smalltalk fileouts to bytecodes. It started to compile directly to JavaScript code, instead of only bytecodes.

It can run from Node.js, and from the browser, too.

I worked on two non-public projects, one using C# with Visual Studio 2010, and other using Java, with Maven, Eclipse, JBoss 5.x

This week I will give a talk at Python Argentina 2013

Keep tuned!

Angel “Java” Lopez

January 6, 2013

New Month’s Resolutions: January 2013

The first month of a new year! I’m was busy coding a lot. It’s time to review past month resolutions:

- Work on PythonSharp [pending]
- Work on AjTalk for C# [complete] see repo and see my posts
- Give a Node.js course [complete] Spanish post
- Start .md pages Java tutorial [pending]

Additionally, I was working on:

- Start Py2Script Python to JavaScript compiler [complete] see repo
- Update my Node.js samples [complete] see repo
- Start and publish version 0.0.1 of SimpleWeb, my middleware layer [complete] see repo
- Start BasicScript [complete] see repo
- Start and publish version 0.0.1 of CobolScript [complete] see repo and see my posts
- Update AjConsorSite [complete] see repo
- Start Inmob [complete] see repo

For this new month, these are my new resolutions (some are already started):

- Start SimpleScript
- Start SimpleBoard
- Start SimpleChess
- Start SimpleGo
- Start and publish a version of SimpleMapReduce, with local and distributed sample
- Start and publish a version of SimpleFunc, object with functions serialization
- Start Memolap, C# in-memory multidimensional OLAP-like library and sample
- Start SimpleMemolap, the same but in JavaScript/Node.js
- Start SimpleRules, forward-chaining rule engine, that compiles to JavaScript

A lot of fun! ;-)

Keep tuned!

Angel “Java” Lopez

December 26, 2012

AjTalk in C# (3) Environments

Filed under: AjTalk, C Sharp, Open Source Projects, Programming Languages, Smalltalk — ajlopez @ 4:46 pm

Previous Post

Some weeks ago, I added environments to my open source AjTalk Smalltalk Virtual Machine, C# version. What is an environment, in my jargon? It’s a dictionary for named artifacts, like classes. Smalltalk global is a classical environment. But I want to add support of other named environments, to avoid class name collisions. Usually, classic Smalltalk have pool dictionaries, but I want something more dynamic. Then, I added Environment, see my tests:

At first, Smalltalk is the current environment:

"Current environment is Smalltalk"
[Environment current == Smalltalk] assert.

You can create new environments:

env := Environment new: #MyEnvironment.

Automatically, the new environment is registered/added to the current one, in this case, Smalltalk:

"The new environment was defined as global at Smalltalk"

[(Smalltalk at: #MyEnvironment) isNil not] assert.
[(Smalltalk at: #MyEnvironment) == MyEnvironment] assert.
[(Smalltalk at: #MyEnvironment) == env] assert.

[MyEnvironment isNil not] assert.
[MyEnvironment == env] assert.

Every new Environment has an entry to Smalltalk:

"Dotted expression syntax sugar for MyEnvironment at: #Smalltalk"

[MyEnvironment.Smalltalk == Smalltalk] assert.

You can switch to a new environment:

env setCurrent.

"Current environment check"

[Environment current == env] assert.
[Environment current == Smalltalk.MyEnvironment] assert.

And then, this is the key feature, the class definitions define a new class AT CURRENT environment:

"Define a class at current env environment, no change to syntax"

Object subclass:#MyClass

[(env at: #MyClass) isNil not] assert.
[(Smalltalk at: #MyClass) isNil] assert.

Orthogonally to environments, I implemented modules: a way to search and load file outs, and running them at a new environment (similar to Python import, or (more or less) to Node.js/CommonJS require). But this is a topic for another post ;-)

Keep tuned!

Angel “Java” Lopez

December 15, 2012

AjTalk In C# (2): A Simple Web Server

Filed under: AjTalk, C Sharp, Open Source Projects, Programming Languages, Smalltalk — ajlopez @ 7:52 pm

Previous Post
Next Post

I’m working completing my Smalltalk VM, written in C#, AjTalk, repo at . Some weeks ago, I wrote a simple web server, based on my PythonSharp (1) A Minimal Web Server. The code:

Object subclass: #WebServer
	instanceVariableNames: 'root listener bytes'
	classVariableNames: ''
	poolDictionaries: ''
	category: ''

!WebServer class methods!

	^self basicNew initialize
! !

!WebServer methods!

	bytes := @System.Array !!CreateInstance: @System.Byte with: 1024 * 16.
	listener := @System.Net.HttpListener !!new.
	listener !!Prefixes !!Add: 'http://*:8000/'.
	root := 'c:/apache-tomcat-6.0.18/webapps/docs'.
	@System.Console !!WriteLine: 'initialize'

process: context
	| filename input nbytes |
	filename := context !!Request !!Url !!AbsolutePath.

	@System.Console !!WriteLine: filename.

	(filename = '' or: [filename = '/']) ifTrue: [filename := 'index.html'].

	(filename !!StartsWith: '/') ifTrue: [filename := filename !!Substring: 1].
	@System.Console !!WriteLine: filename.

	filename := @System.IO.Path !!Combine: root with: filename.

	@System.Console !!WriteLine: filename.	

	(@System.IO.File !!Exists: filename) 
	ifFalse: [ context !!Response !!Abort. ]
	ifTrue: [		
		input := @System.IO.FileStream !!new: filename with: @System.IO.FileMode !!Open.
		[[nbytes := input !!Read: bytes with: 0 with: bytes !!Length] value > 0] whileTrue: [
			context !!Response !!OutputStream !!Write: bytes with: 0 with: nbytes.

		input !!Close.

		context !!Response !!OutputStream !!Close

	listener !!Start.
	@System.Console !!WriteLine: 'start'.
	[true] whileTrue: [
		| context |
		@System.Console !!WriteLine: 'get context'.
		context := listener !!GetContext.
		@System.Console !!WriteLine: 'new request'.
		self process: context.
	@System.Console !!WriteLine: 'end start'
! !

WebServer new start

It’s only a quick and dirty proof of concept. You can launch it using the console program (AjTalk.Console project):

ajtalk lib\ Programs\

The result at http://localhost:8000

I wrote a more clear module/example at

Module import: #Web.


| server |

server := Web.Server new
	root: 'c:/apache-tomcat-6.0.18/webapps/docs';
	addPrefix: 'http://*:8000/';

Module import: is my way of loading programs, a la Python import. But this is a topic for other post.

Keep tuned!

Angel “Java” Lopez

December 12, 2012

AjTalk in C# (1): A minimal Hello, World image

Filed under: AjTalk, C Sharp, Open Source Projects, Programming Languages, Smalltalk — ajlopez @ 2:11 pm

Next Post

If you read this blog (and have the patience to follow me at Twitter ;-), you already know I was busy working on my AjTalk Smalltalk-like VM written in C#:

There is a small Hello, World:

nil subclass:#Object

Object subclass:#Program

!Program class methods!

main @System.Console writeLine: 'Hello, world'! !

At repo:

It coud be smaller, but the Program main is the entry point of a saved image. The console program can generate an image using

ajtalk Programas/ –s

and then, launch the image with


In this case, AjTalk looks for a global Program with a method main, and if it exists, it will be invoked.

The @ notation for @System.Console is the way to refer to a native .NET type.

Note that I don’t load all the class library, only the classes that I need for run the image. AjTalk can manage many Smalltalk machines in memory, each one with its own classes and methods. I have implemented a way of manipulating one machine from another, so you don’t need, in principle, to have a complete environment in machine A. So, I can produce minimal image, if I remove the classes and methods I don’t use. Instead of having a big image in memory, and cut the fat, my running machines born light by design. This is an example of “thinking out of the box”: for decades, Smalltalk developers thought on having only one image, and were struggling on how to make it an smaller one. My approach is totally different: make the VM so it can manage many machine/images in memory, so one can be manipulated from another one.

I should write more about the current implementation and features (and issues to solve), like: remote objects, object methods, processes, semaphores, multithreading, native access, save/load images, internal AST, visitors, code generation for JavaScript, bytecodes in compiled blocks, modules (loosly inspired in Python import,  and Node.js require), environments (to avoid class name collision), and more.

Keep tuned!

Angel “Java” Lopez

Older Posts »

The Shocking Blue Green Theme. Blog at


Get every new post delivered to your Inbox.

Join 57 other followers