Want to contribute? Fork us in GitHub!

Placing and Unplacing in JAR Artifacts

The entire process of packaging EO objects and atoms into JAR artifacts is explained in this blog post: Objectionary: Dictionary and Factory for EO Objects. It’s pretty straight forward. However, there is one tricky situation related to placing compiled Java binaries into the JAR. This process may go wrong and sometimes it does. In version 0.24.0 of our Maven plugin we introduced a pair of options for the unplace goal. Here is how they work.

Introduced 'switch' Object

Since 0.23.16 version it is possible to use switch object just like this:

memory "swordfish" > password

    password.eq "swordfish"
    "password is correct!"
    password.eq ""
    "empty password is not allowed"
    "password is wrong"

Here, switch object returns “password is correct!”, which is the first true case in this statement. The switch object consists of arrays with arrays of two elements: condition and return value.

If the above parameters are missing, switch will return an error object with msg as a string message.

How to Compile Against a Fixed Version of Objectionary

When you compile your EO code, the compiler discovers which objects are “foreign” and tries to find them in Objectionary. It finds them, downloads, and then compiles locally. The problem is that the objects in Objectionary are not static: they get new versions very often. That’s why, in order to stabilize your build you may want to use their fixed versions.

Introduced 'number' Object

Since 0.23.15 version it is possible to use number object just like this:

# this is 7
(QQ.math.number -7).abs 

It is a decorator of int and float objects with the following additional attributes:

Unit Testing with 'eoc'

There is eoc, a command line tool that helps you automate compilation, transpilation, and execution of simple EO programms. With this tool you can also create and execute unit tests. Just name them *-test.eo and add metas +junit to them.

Introduced 'string.slice' Object

Since 0.23.8 version it is possible to use string.slice object just like this:

"Привет".slice 1 2

Here, slice object returns “ри” string, which is a substring of “ри” string from the specified start position and with the length len.

If above parameters will be out of bound, slice will return an error object instead of a new string object.

Memory Can't Be Empty

Until version 0.23.7 it was possible to use memory object just like this:

memory > m
m.write 42

At the first line, a copy of memory was made and then labeled as m. This was a bug in the language. The object memory must not be copied if there are no arguments provided for the copying (application) operation.

We Got Rid of Object 'char'

Since 0.23.6 version of EO we get rid of char object. We want to simplify core of the language and believe that this object can be easily replaced with its actual representation, i.e. an array of bytes. Now, if you want to get the character, you can just use string object instead. All of these examples are valid strings: "\u0123", "h", "\t", "\n" and "\07". We get rid of string.char-at and bytes.as-char objects.