Angel \”Java\” Lopez on Blog

July 17, 2014

ScalaSharp Simple Scala In C# (1) The Idea

Filed under: .NET, C Sharp, Open Source Projects, Programming Languages, Scala, ScalaSharp — ajlopez @ 6:32 pm

I wrote something in this blog, but it’s time to introduce it to society. Last year a few months ago, I started the project:

A simple interpreter for a simplified Scala, C #. I do not intend to implement all Scala as a compiler for CLR. NET. My intention is to explore an alternative implementation of interpreter, adopting only some “light” features of Scala.

Without being a Scala programmer (or amateur or professional) my impression is that Scala as a language and library, is something like "too much", a bit overwhelming. People adopts Scala because it is more flexible, less need "boilerplate" etc.. But it seems like Scala went too far. Having programmed in Java and C#, I think the latter, adding a few things (delegates years, lambdas, extension methods, "generics" in the VM, and recently, in asynchronous input/output, async, await), has managed to stay healthy, without major complications. See how easy it has been to implement LINQ with evaluation "lazy" and others.

Instead, Scala seems to me like it’s too many things, all together. From what I saw, type inference is a feature that is not so necessary in the real projects. And yet I can not accept that the list of operators in Scala occupies more than one web page. But hey, that’s the current state of things. People Scala is working on a new implementation, called Dotty. But if you are just doing after years of language definition, I have to declare: "too little, too late."

That does not preclude recognizing that Scala has great triumphs, non-trivial applications like Play Framework and Akka. Akka is a very interesting project. I think we don’t need so many new language features (just the ones I mentioned for C #). We need more libraries that solve some issues (such as the implementation of an asynchronous HTTP message distribution server or distributed processing among actors).

To experiment with a simplified Scala, and to deliberately practice TDD (Test-Driven Development) in C #, I started the project ScalaSharp.

It is a challenge for me, because it is not a simple interpreter. I want to implement an AST (Abstract Syntax Tree) that detects inconsistencies between types. In my previous experiences, as RubySharp, PythonSharp, and Mass language, it was only necessary to assemble a tree expressions / commands and evaluate it. Now I’ll have to check that the types are correct. For example, one variable that is typed, and that their assignments, the expression to be evaluated and assigned for the type of the variable. You can see some of the work in progress:

where there is a node tree with types, versus commands and expressions to be executed and evalauted:

Upcoming topics: implementation details, control types in the AST transformation commands / expressions. The good thing to do with TDD is that it allows me to go implemented the solution as I define use cases.

Stay tuned!

Angel “Java” Lopez

July 16, 2014

RubySharp, implementing Ruby in C# (3)

Filed under: .NET, C Sharp, Open Source Projects, Programming Languages, Ruby, RubySharp — ajlopez @ 4:43 pm

Previous Post

In RubySharp, we can define new functions (methods of the current object), and invoke them. There are some built-in functions in C#:

Every function should implement the interface:

public interface IFunction
    object Apply(DynamicObject self, Context context, IList<object> values);

On apply, each function receives the object (self), the context for variables (locals, arguments, closure….), and a list of already evaluated arguments.

An example, the implemention of puts:

public class PutsFunction : IFunction
    private TextWriter writer;

    public PutsFunction(TextWriter writer)
        this.writer = writer;

    public object Apply(DynamicObject self, Context context, IList<object> values)
        foreach (var value in values)

        return null;

It receives the object to which it is a method, the context, and a list of arguments. Each of the arguments was evaluated. The implementation simply sends the arguments to a TextWriter, one argument per line. The TextWriter is provided when the function object is created (in the Machine object, that represents the current running environment). This injected facilites the test of the function, example:

public void PutsTwoIntegers()
    StringWriter writer = new StringWriter();
    PutsFunction function = new PutsFunction(writer);

    Assert.IsNull(function.Apply(null, null, new object[] { 123, 456 }));

    Assert.AreEqual("123\r\n456\r\n", writer.ToString());

The above code was born using the TDD workflow.

Let’s see another built-in function, require:

public class RequireFunction : IFunction
    private Machine machine;

    public RequireFunction(Machine machine)
        this.machine = machine;

    public object Apply(DynamicObject self, Context context, IList<object> values)
        string filename = (string)values[0];
        return this.machine.RequireFile(filename);

This time, the job of loading a file is delegated to the Machin object, injected in the constructor.

And finally, let’s review the code of a defined function (defined in RubySharp):

public class DefinedFunction : IFunction
    private IExpression body;
    private IList<string> parameters;
    private Context context;

    public DefinedFunction(IExpression body, IList<string> parameters, Context context)
        this.body = body;
        this.context = context;
        this.parameters = parameters;

    public object Apply(DynamicObject self, Context context, IList<object> values)
        Context newcontext = new Context(self, this.context);

        int k = 0;
        int cv = values.Count;

        foreach (var parameter in this.parameters) 
            newcontext.SetLocalValue(parameter, values[k]);

        return this.body.Evaluate(newcontext);

In this case, a new contexts is built, containing the new arguments to the defined function, but with the original closure, injected in the constructor. The context provided in the Apply is not used.

Next topics: some command implementations, the Machine object, the REPL, etc…

Stay tuned!

Angel “Java” Lopez

July 12, 2014

Mass Programming Language (5) Variables Scope

Filed under: .NET, C Sharp, Mass, Open Source Projects, Programming Languages — ajlopez @ 6:18 pm

Previos Post

I finally started a new implementation of variables and their scope in programming language Mass. My idea is:

– Have local variables

– No need to explicitly declare

– Access available "outside" if necessary

The basic idea is:

– Any variable assignment involves the local level

That is, if I assign

a = 3

in a function, this refers to a local variable in the function. No matter if there is a variable external to the function

See for example

# file variable
a = 1

define foo()
    a = 2 # local variable


The first variable a is a variable of the file in process (the module). The variable assigned in the foo function is local to that function, and it is different from the outside variable.

But if we do not assign the variable, and only consulted it, its value is returned. example:

# file variable
a = 1

define foo()
   a # access file variable


In this case, the function foo returns the value to "outside", since this variable has not been assigned in the function when evaluating the return value.

How to edit an "external” variable, that is, a non-local variablel? Well, this is a topic for an upcoming post. The idea: to access the value of a non-local variable, it must be implied, without declaring anything extra. BUT modifying its value must should be explicit: we put something to explicitly declare "we are changing the value of a non-local variable".

Stay tuned!

Angel “Java” Lopez

July 8, 2014

New Month’s Resolutions: July 2014

Filed under: C Sharp, JavaScript, NodeJs, Open Source Projects, Programming Languages — ajlopez @ 4:50 pm

A new month started, time to review my June 2014 resolutions, and write new ones:

– Continue AjErl [pending]
– Continue ScalaSharp [complete] repo 
– Continue SharpGo [complete] repo
– Variable scope in Mass Language [complete] repo
– Start SimpleItems [pending]
– Continue SimpleApps [partial] repo
– Continue ClojSharp [pending]
– Continue DictSharp [pending]
– First AjErl distributed use case [pending]
– First Aktores distributed use case [pending]
– Write C# Posts [complete] Spanish Posts
– Write TDD Post [complete] Spanish post
– Improve my personal site code [complete]

Additionally, I worked on:

– Create and publish first version SimpleCurry, functional programming helpers in JavaScript [complete]  repo
– Create and publish first version LoadJsons, load JSON model from many files, in JavaScript/Node [complete]  repo
– Create a Dynamic Site in Express 4, defined by JSON [complete]  repo
– Generate Express 4 code using AjGenesisNode [complete]  repo
– Generate Sinatra code using AjGenesisNode [complete]  repo
– Improve AjGenesisNode, AjGenesisNode-Model, AjGenesisNode-Entity [complete]  repo repo repo
– Continue DylanSharp [complete]  repo
– Create SharpBus, Mule-like simple bus in C# [complete]  repo

These are my resolutions for July 2014:

– Improve AjGenesisNode code generation for Express
– Improve AjGenesisNode code generation for Sinatra
– First AjGenesisNode code generation for Laraval
– Module loading, export review in Mass Language
– Continue with SharpBus
– Continue with Dynamic Site
– Give a talk about Node.js/Express
– Improve my personal site code
– Write TDD Post
– Write C# Posts
– Distributed use using Aktores
– Review, refactor and continue RustScript implementation

More fun is coming.

Stay tuned!

Angel “Java” Lopez

July 4, 2014

Smalltalk: Links, News And Resources (18)

Filed under: Links, Programming Languages, Smalltalk — ajlopez @ 10:04 pm

Previous Post 
Next Post

gravel-st/gravel · GitHub
Smalltalk in Java’s-Home-page/Squeak/RTOSinSmalltalk.html.pdf’s-Home-page/Squeak/RTOSinSmalltalk.html.pdf


tim’s Home page

Oral History of Adele Goldberg – YouTube


hhzl (Hannes Hirzel)

Lively Kernel – Home

Viewpoints Research Institute

Welcome to Self — Self – the power of simplicity

Fast and Dynamic

Jon’s Place: Roz & RobotsConf

Smalltalk intro i

Smalltalks13 pharo techoverview

Smalltalks 2007 to 2012 History – YouTube

SqueakSource de l’Ecole des Mines de Douai

Seed: Pharo Kernels

Germán Arduino: Finalizó Smalltalks2013

Smalltalks2013 – a set on Flickr

nativeboost – Squeak NativeBoost plugin source code – Google Project Hosting

My Links

Stay tuned!

Angel “Java” Lopez

May 9, 2014

New Month’s Resolutions: May 2014

Time to review my April 2014 resolutions:

– Continue AjLispScala [pending]
– Continue AjGenesisNode-Express [partial] see repo
– Continue AjGenesisNode-PHP [pending]
– Continue RuScript [pending]
– Continue RustScript [complete] see repo
– Distributed Messages in AjErl [partial] see repo
– Give a talk Intro to Node.js [complete] see repo see online talk
– Publish a new Node.js video tutorial [complete] see post

Additionally, I worked on:

– Start SharpGo interpreter [complete] see repo
– Start SimpleNeuron in JavaScript [complete] see repo
– Refactor, extend and publish new version of SimpleFlow [complete] see repo
– Improve SimpleScraper [complete] see repo
– Improve ClojSharp [complete] see repo
– Improve Aktores [complete] see repo

The resolutions for the new month, May 2014:

– Work on SimpleScraper, first use cases
– Continue RuScript
– Continue RustScript
– Continue SharpGo
– Continue Distributed Messages in AjErl
– Improve Mass Language
– Continue Aktores (first distributed features)

More fun is coming!

Keep tuned!

Angel “Java” Lopez

April 5, 2014

Always Be Coding

Filed under: Open Source Projects, Programming Languages, Software Development — ajlopez @ 10:49 am

As a professional software developer, we should pursue to be better programmers. One activity I adopted some years ago, is: "Always Be Coding”. Every day, write a piece of code. Try something new. Improve something old. Open your brain. Explore a new path. Learn a new language. Practice TDD every day. Push for simplicity. Start a simple project “Hello world” using new technology or operating system. Write a simple web site using the new web framework in the block. If you write C# or Java, try Ruby or Clojure. If you use Ruby on Rails, try Sinatra, or make a switch to Python and Django. If you like Lisp, try ClojureScript for a web project. If you like Smalltalk, try Pharo and Seaside. If you are a programming language geek, go for Rust, Go, Dart. If you write ASP.NET MVC for a living, try SignalR, then Node.js and Socket.IO. Change your editor. Change your programming language. Or write your own.

Even if all these languages, technologies, libraries, and frameworks are not in your “daily work”, the new insights are welcome. And the constant practice makes the master. If you keep the brain open, new ideas could fertilize your mind and your skill toolbox. In our profession, the change is the only constant. Altought there are other things to practice, “soft” skills, teamwork, you (and me) should be trained every day.

So, to put my money where my mouth is, every day I write a piece of code, in public and non-public projects. Partial evidence:

That’s is my public commitment: to write code every day. To learn something new, to practice an skill, to explore a new way of doing things. Always be coding

More fun is coming.

Original photo from

Keep tuned!

Angel “Java” Lopez

April 3, 2014

New Month’s Resolutions: April 2014

Review of my March’s resolutions:

– Work on DictSharp [complete] see repo
– Give talk about Node.js Distributed Applications [complete] see repo see online slides
– Improve SimpleGammon [complete] see repo
– Improve Annalisa [complete] see repo
– Add @for to Templie [pending]
– Work on PreciosaAnnalisa online web services [complete] see repo
– Improve my Node.js Distributes Applications samples [complete] see repo see repo see repo
– Work on ScalaSharp [complete] see repo
– Improve ClojSharp [complete] see repo
– Improve SimpleAsync, do operation (functions in parallel) [pending]
– Improve Aktores [pending]
– Distributed messages in AjErl [pending]
– Add variable scope to Mass language [pending]
– Start code generation as a service [partial]

Additionally, I worked on:

– Complexo, simple complex numbers operations in JavaScript [complete] see repo
– Started RustScript, a Rust programming language interpreter in JavaScript [complete] see repo
– Continue RuScript, a Ruby interpreter in JavaScript [complete] see repo
– Continue RubySharp, a Ruby interpreter in C# [complete] see repo
– Started AjLispScala, a Lisp interpreter in Scala, using TDD and SBT [complete] see repo
– Recorded a second video Node.js Spanish tutorial [complete] see post

For this new month, my resolutions are:

– Continue AjLispScala
– Continue AjGenesisNode-Express
– Continue AjGenesisNode-PHP
– Continue RuScript
– Continue RustScript
– Distributed Messages in AjErl
– Give a talk Intro to Node.js
– Publish a new Node.js video tutorial

More fun is coming.

Keep tuned!

Angel “Java” Lopez

March 5, 2014

End Of Iteration 2014w09

Previous Post
Next Post

More interesting stuff for my neuron, and deliberate TDD (Test-Driven Development) practice.


A lot of new work at

It takes an string and extract information based on rules. For example, it can detect the brand of a product description, its weight, weight unit, etc. I put an online demo in Spanish for analyze or search into Preciosa project data:


I started a simple in-process, in-memory key/value store in C#:

A dictionary with a an internal tree, instead of using hashes. I should complete the node split operation, enumerate the keys, and compress the keys. A key is an string, and the associated value could be typed or a generic object.


Motivated by a use case of Preciosa project, I wrote:

A simple JavaScript module to manage a list of geolocated items (via latitude, longitude), and then retrieve the items near a point in a given radius.


I refactored my in-memory repository:

to support optional autonumeric ids, and tests using SimpleUnit. Notably, I found an issue: SimpleUnit can be installed as global module in NPM (Node Package Manager) but the bin file has a shebang (!#) in the first line, ending with \r\n (carriage return line feed). Then, Linux operating system take the shebang, and use it as the name of the program to execute the script, WITH THE CARRIAGE RETURN in the name. So, I fixed it removing the carriage return. Weird thing in the third millenium. I updated

to have no carriage return in bin scripts.


I worked on two non-public projects, using C#. I started my Python samples I added some nodes to AST (Abstract Syntax Tree) in

More fun is coming.

Keep tuned!

Angel “Java” Lopez

January 23, 2014

Erlang: Links, News And Resources (6)

Previous Post
Next Post

Elixir – A modern approach to programming for the Erlang VM on Vimeo

15 Erlang – Distributed Programs – Node Creation – YouTube

JLOUIS Ramblings: Acme as an editor

Erlang/OTP at EE: journey and lessons learned – Erlang User Group (London, England) – Meetup

Erlang Factory – Dublin Erlang Factory Lite 2013 – Register

Aprendiendo Erlang: Comunicación entre procesos (Ping-Pong).

Erlang — Concurrent Programming

extend/bullet · GitHub
Bullet is a Cowboy handler and associated Javascript library for maintaining a persistent connection between a client and a server.

duomark/erlangsp · GitHub
Erlang Services Platform

Erlang the movie II the sequel

Erlang-style Supervisor Module for Scala Actors ←

Open Telecom Platform – Wikipedia, the free encyclopedia

What They Don’t Teach You About Running a Business When Taking Your CS Degree

Parsing packets Erlang style using core.logic

ErlangDC 2013 Conference

jacobgroundwater/federation · GitHub
Node.js. Federation is inspired by Akka and Erlang, and borrows some semantics from the actor model.

Federation by jacobgroundwater
Federation is a federated message network for distributed environments

Programming Rules

[erlang-questions] hobbyists, erlang, elixir (was Improve $handle_undefined_function)

Merge branch ‘bjorn/remove-parameterized-modules/OTP-10616′ · 35adf88 · erlang/otp

Persisting your entities in erlang

My Links

Keep tuned!

Angel “Java” Lopez

« Newer PostsOlder Posts »

The Shocking Blue Green Theme. Blog at


Get every new post delivered to your Inbox.

Join 68 other followers