ABS 1.4.0: welcome unicode!

A few weeks ago I released version 1.4.0 (and 1.4.1, with an additional bugfix) of the ABS programming language: in this post, I’d like to explain everything major that made it in this new minor release.

ABS ❤ unicode

We have implemented unicode in ABS: you can now use both unicode letters in variable names as well as any unicode character in strings.

For example, you can output any code point within a string:

1
2
echo("I ❤ ABS")
echo("Hello 世界!")

as well as use unicode letters in variable names:

1
2
ȼ = "this is a weird c"
echo(ȼ) // "this is a weird c"

Note that only unicode letters (category L) are allowed as variable names, and using any other character will result in a parsing error:

1
2
3
4
   = a
 parser errors:
  Illegal token '❤'
  [1:1]   = a

eval(…)

Oh, good old-school eval!

This function does exactly what you’d expect it to do, as it executes the ABS code passed as its argument:

1
2
3
test = [1, 2, 3, 4]
eval("test.len()") // 4
eval("test.len()").type() // NUMBER

Digits in variable names

We now support digits in variable names:

1
v4r14bl3 = "I got numbers"

We might expand this feature later on to include unicode numbers, if the community feels like this would be a useful feature (haven’t heard of any use case so far).

Numeric separators

Following Python 3.6 and JS on Chrome 75, we’ve decided to help with readability on large numbers and allow _ as a numeric separator:

1
2
3
4
5
6
7
// before
ten_grands  = 10000
ten_yards   = 10000000

// now you can...
ten_grands  = 10_000
ten_yards   = 10_000_000

Panic without a terminal

We fixed a panic when you try to run the ABS REPL without having a terminal attached (for example, during a Docker build, or when piping a bare abs command); ABS will now explicitely let you know what the problem is:

1
2
3
4
5
6
7
8
9
$ abs > file.txt

$ echo $?
1

$ cat file.txt
Hello alex, welcome to the ABS (1.4.1) programming language!
Type 'quit' when you're done, 'help' if you get lost!
unable to start the ABS repl (no terminal detected)

Panic when converting empty strings to JSON

We fixed a pnic when trying to convert an empty string to JSON, which will now convert to an empty string:

1
"".json() // ""

Fixes to JSON conversion of hashes

You can easily convert an hash to JSON through the builtin .str () function:

1
2
3
4
5
6
7
$ key = "hello"
$ value = "world"

$ hash = {key: value}

$ hash.str()
{"hello": "world"}

There was an issue when converting keys or values with double quotes in them, but it has since been fixed. Code such as '{"x": "\"y"}'.json().x will now work seamlessly.

Go modules

We’ve migrated the codebase to Go modules: even though this might not be a ground-breaking change, it should help those who develop the ABS core, allowing no conflicts when it comes to dependencies.

Now what?

Install ABS with a simple one-liner:

1
bash <(curl https://www.abs-lang.org/installer.sh)

…and start scripting like it’s 2019!

PS: Again, many thanks to Ming, who’s been taking a larger role as the weeks went by. Without her, many of the stuff included in 1.4 wouldn’t be possible!

PPS: 1.5.0 is already well underway — expect it in the next few days. We’ll be introducing extremely interesting features such as file writers, so it’s going to be an exciting release!


In the mood for some more reading?

...or check the archives.