Monthly Archives: December 2012

Smalltalk: Links, News And Resources (9)

Previous Post
Next Post

Building a Business with Cincom Smalltalk™ by Arden Thomas and Dirk Verleysen


Introduction to Smalltalk

Porting from VisualWorks to Squeak

Namespaces (Was: MNU in tools after loading parcel)

The System Browser 101

Building the VM – Second Part

Building the VM from scratch using Git and CMakeVMMaker

Mac Squeak VM

Reef is a framework to manage dynamic web components for Seaside

Project Renaissance: Harness Emergence

Sly and the RoarVM: Exploring the Manycore Future of Programming

tODE – the Object (centric) Development Environment

Byte Magazine Volume 06 Number 08 – Smalltalk (August 1981)

Dale Henrich’s GitHub Repositories

Videos Smalltalks 2010
Inline caching (Part 1) by Eliot Miranda

Videos Smalltalks 2010
Code generation (Part 1) by Eliot Miranda

Smalltalk is cool

Do object-oriented programming languages exist that are not class-based?


Smalltalk Tutorial

Turn your programming environment into a beauty center for objects

MicroSeeker Screenshots

Underwater Vehicles: MicroSeeker

The Mist Project
There is no “C” in “Smalltalk”

What If: Developing Applications in the Multicore Era

Jugando con Comet en Squeak

Monticello is a distributed optimistic concurrent versioning system for Squeak code. It was written by Avi Bryant and Colin Putney, with contributions from many members of the Squeak community.

IM 101: Object Memory Management in VisualWorks

My Links

Keep tuned!

Angel “Java” Lopez

CobolScript (3) Templates

Previous Post
Next Post

I like to have a template engine in my languages, so, I added one in my open source CobolScript, COBOL compiler to JavaScript. The first sample:

The code:

data division.
working-storage section.
01 n.

procedure division.

perform show-factorial varying n from 1 to 10.

local result.
perform factorial using n giving result.
${n}!= ${result}
factorial using n.
local m.
if n = 1 then return n.
subtract 1 from n giving m.
perform factorial using m giving m.
multiply n by m.
return m.

The template file is compiled to COBOL transforming every text to DISPLAY … WITH NO ADVANCING (the new lines are already in the text). The code between <# and #> is copy as is to the COBOL program. Every expression between ${ and } is expanded as another parameter to a DISPLAY command. Then, after compiling all the texto to COBOL, CobolScript compile it to JavaScript. The template syntax is a kind of syntax-sugar.

The output of the program:


1!= 1
2!= 2
3!= 6
4!= 24
5!= 120
6!= 720
7!= 5040
8!= 40320
9!= 362880
10!= 3628800

I could use the template support to generate text files, that is, to implement code generation in CobolScript, as I did in AjGenesis (classic, Ruby, Node.js). I already have a dynamic web page implementation based on this template engine (yes, dynamic web pages in CobolScript ;-). But that is a topic for another post.

Keep tuned!

Angel “Java” Lopez

Smalltalk: Links, News And Resources (8)

Previous Post
Next Post

Seaside + jQuery Mobile

Agent-based simulations

StepTalk is the official GNUstep scripting framework that represents separate scriptable servers or applications as a single object environment. It is meant to be independent of the programming language used; its default language is Smalltalk on top of the Objective-C runtime.


Spoon 3 beta 2 (“Usable By Humans”) released
A different way to group different existent packages / classes for specific goal.

Decomposing the Ulam spiral

martinmcclure / mist
Mist is a project to create a Smalltalk variant that is implemented without a virtual machine, is implemented without depending on any other language, is simple, consistent, and is reasonably fast.

Seaside Statefulness: Call-and-Answer

Seaside without Continuations?

Are continuations a key feature in Seaside?

Seaside: Continuations and Subroutine Calls


A lightweight, image based, encapsulated development environment based around Smalltalk, specifically, “A Little Smalltalk” version 3.0 by Timothy A. Budd

Little Smallscript is a dialect of Smalltalk that compiles into JavaScript.

VA Smalltalk Videos

U8 Newsletter

LSW Vision Smalltalk & DNG!topic/comp.lang.smalltalk.dolphin/c-5kV_pKleg

ESUG European Smalltalk User Group 2012 – 20th International Smalltalk Conference

My Links

AjTalk in C# (3) Environments

Previous Post
Next 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

CobolScript (2) First Factorial Function

Previous Post
Next Post

JavaScript is butter in my hands ;-). I was working on CobolScript, my COBOL compiler to JavaScript.

I added the support for user-defined functions, parameters, arguments and local variables. The first example, factorial:

You can run it, executing command line in that folder:

node run factorial.cob

data division.
working-storage section.
01 n.

procedure division.
perform show-factorial varying n from 1 to 10.

show-factorial local result.
perform factorial using n giving result.
display n "! = " result.

factorial using n local m.
if n = 1 then return n.
subtract 1 from n giving m.
perform factorial using m giving m.
multiply n by m.
return m.

The new syntax features:

performusing … You can call a local procedure passing arguments.

– <proc> using …  The procedure declares its arguments.

– <proc> local(s) … The procedure declares its local variables.

performgiving <var>…  You can specify that a perform has a return value, to be saved in one or more variables.

return (expr)  The procedure can return at any point. A return value could be specified.

I just added web page support, but that is a topic for another post 😉

Keep tuned!

Angel “Java” Lopez

CobolScript (1) COBOL compiler to JavaScript/Node.js

Next Post

Today, I started a new project at my Github account:

It’s a compiler from COBOL to JavaScript. It’s work in progress, but the Hello, world is running:


You can run it, executing:

node run hello.cobs

A more complete code:

    DATE-WRITTEN. 2012-12-22.
    DATE-COMPILED. 2012-12-22.

Let’s run it executing:

node run hello.cob

My work was written using TDD (Test-Driven Development). I shoudl add a lot of things: picture support, working storage section, file section, and maybe, SQL execute commands. But it’s a good starting point. It can run on browser and on Node.js.

Keep tuned!

Angel “Java” Lopez

COBOL: Links, News And Resources (2)

Previous Post

COBOL on Cogs

Java is becoming the new Cobol

IBM Mainframes
Online IBM Reference Manuals



COBOl Tutorials

The aim of this COBOL tutorial site is to give the basics of the COBOL programming language for anyone who knows a little bit about computers (not much) and preferably will at least have come across another procedural progamming language such as C, QBASIC or Pascal.

COBOL Programming Tutorial

COBOL programming – tutorials, lectures, exercises, examples

Compile Online

The SOUL program query language
Query and inspect your Java, Smalltalk, C and Cobol programs.

When Did That Happen?
Grace Murray Hopper and Automatic Coding

COBOL Reborn
(2005) "COBOL is like an invisible giant. There’s reported to be 180 billion-200 billion lines of code out there, processing 75% of commercial business. Few companies are keen to throw away the hundreds or thousands of man-years that have been invested in mature, high-performance COBOL code. Instead, they are integrating and building bridges between COBOL, .NET and J2EE [Java 2 Platform, Enterprise Edition], using service-oriented architectures to preserve the strengths of the legacy code while benefiting from Web-oriented development tools,"

Universal Cobol Compiler
The Universal COBOL Compiler (UCC) is a Java-based COBOL to Java bytecode cross-compiler. It’s made up of a COBOL compiler, a Java-based COBOL runtime, and a package for manipulating Java class files.

The COB2J® translator is a family of Microsoft Windows cross compiler programming tools that accepts many COBOL source code dialects and translates them to JAVA or J#. The translation process is a simple turn key process with minimal user intervention. The translator output is JAVA or J# code that is ready to be tested with the target compiler. Simply run your COBOL code through the translator and start debugging JAVA code with your target compiler.

isCOBOL Evolve
By compiling COBOL code into Java, isCOBOL software allows your organization to retain and enhance valuable COBOL application and development assets, while taking full advantage of the Java technology platform in deployment.

My Links

First Ideas for a Claim Rule Engine

I am looking for applications of my scripting languages. I want to use AjLang, the core of AjSharp, written in C#. One use case could be a claim rule engine. To understand what I have in mind, and the federated security jargon/landscape, see:

The Role of the Claims Engine
The Role of the Claim Rule Language
The Role of Claim Rules
The Role of the Claims Pipeline
The Role of Claims

Given a set of input claims, the system should produce a set of output claims, using user defined rules. A rule could be written as:

rule RuleEmail
   description “….”
   claim cmail
   cmail in InputClaims
   cmail.Type == “email” 
   claim cname = new Claim(…. )
   // more cname processing, maybe extracting a value from email
end rule

Something like my example at but more oriented to C# syntax (i.e. the use of native .EndsWith in the above example)

If I had omitted cmail in InputClaims, the claim will be searched in all claim sets.

Additional item: to have a web interface to edit and browse rules.

The rules would be executed in order. I could write rule sets, to group rules to be executed. For example: Identity Provider rule set, to be applied to the claim set provider by an IP, i.e. Windows Live, Yahoo, etc. Or a Relying Party rule set, defined by application: accounting system, human resource system, finance, etc..

In the “then” part, additional functions could be call. The functions would be added by the developer to the rule engine environment, maybe with dynamic loading of a library. Then, the actions will be extensible by code. The “when” part could use additional predicates, too. But the base idea is to have an initial set of predicates and actions that cover the main use cases: testing property values, creating new claims, setting their property values, adding to a claim set (InputClaims, OutputClaims or any other set defined by the programmer).

One thing to decide: what happens if there are TWO or more claims that satisfy then when clause? the rule should fire only once? or n times? I remember the cut operator from Prolog, but I guess it could be simpler. I should explore the use cases.

No time allocated for these ideas, yet. But keep tuned!

Angel “Java” Lopez

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

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

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

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