But this time I wanted to implement something with simple sintax and semantic. Indeed, I was playing with “simple” ideas for a compiler over Javascript, see SimpleScript (1) First Ideas.

Then, with Mass, I deliberately wanted to avoid:

– Multiple commands in the same line (I discarded ‘;’ like in Ruby)

– Syntax based in spaces and indentation (Python discarded)

– Function invocation using only the name; Mass impose the explicit use of parenthesis (Ruby discarded; Mass is like JavaScript)

– Base values and classes (integers, strings, lists, etc…) having a crowd of methods (like Ruby and Python). No, Mass prefers to expose and use the underlying language/class library.

Then, I wanted:

– Functional values, as first-class citizens, like in JavaScript. So, having to put explicit parenthesis to invoke a function allows me to use the name of the function as a functional value

– Dynamic objects: each object can be extended at any moment, with new instance variables, object functions, a la JavaScript

– Syntax based in lines: each command has its own line. No command separation

– Syntax based in keywords: the end of a command list is marked with ‘end’, no braces

– As far as possible, only one way to do something, instead of the many ways motto a la Perl

– Complete keywords, then ‘define’ instead of ‘def’

– Simple inheritance at classes. But Mass could be expressive without written classes, using native classes from .NET framework and other libraries. It could be used as an scripting language.

– Explicit setting of variables that are out of the local scope (a topic for next posts)

– Variable scope by file, like in the require of JavaScript/NodeJs/CommonJS

– Module by file, with a require that automatically searches in directories, a la NodeJs/CommonJs. Notably, Mass can consume node_modules folder, so Mass module can be published and installed using NPM!

– Package manager, using NPM. You can use package.json to declare the dependencies, and publish new modules at NPM (using ‘mass-‘ as the suggested namespace).

In upcoming posts, I will write more details about implementation, guiding design ideas, examples. But now, you can see the code and the test examples at public repo. And yes, all was written by baby steps, using TDD.