github abs-lang/abs 1.8.0
v1.8.0

latest releases: 2.6.0, 2.5.2, 2.5.1...
4 years ago

A new minor release of ABS: always be shipping! 🚢

ABS 1.8.0 brings a bunch of interesting features and bugfixes, spearheaded by the module installer that lets you download ABS modules with a simple abs get github.com/user/repo!

The ABS module installer

ABS is now bundled with a very simple module installer (#277). What the installer does is to fetch an archive from Github and place it under a vendor/ directory. You can use it by running abs get $ARCHIVE, where archive is a github repository URL in the form github.com/user/repo.

See it in action:

asciicast

Once a module is installed, it will also be aliased in a file called packages.abs.json:

{
    "abs-sample-module": "./vendor/github.com/abs-lang/abs-sample-module-master"
}

You can then require the module either through its full path or the alias, both will work. The alias, though, is there to make it easier for you. Please note that when you call require(path), a valid ABS file needs to be present at path, or path should be a directory containing an index.abs file. This is very similar to NodeJS' require mechanism.

Unfortunately, having to bundle the installer means the ABS distribution just got a little heavier, from 2 to around 5 MB. In the world of 5G, though, this shouldn't be a huge problem.

Negative indexes

You can now specify negative (#276) indexes to access array elements! Want to grab the last element of an array without having to know its length?

list = [1,2,3,4]
⧐  list[-1]
4

array.tsv()

We've added a very useful functionality to arrays, which is the ability to convert them into TSV/CSV output:

⧐  list = [["name", "age", "sport"], ["LeBron", "34", "basketball"], ["Virat", "30", "cricket"]]
⧐  list.tsv()
name	age	sport
LeBron	34	basketball
Virat	30	cricket
⧐  list.tsv(",")
name,age,sport
LeBron,34,basketball
Virat,30,cricket

You can specify a separator to be used, so CSV is supported out of the box. We rely on encoding/csv for this feature (#282).

Bash-style interpolation in strings

Interpolation in strings now follows the same conventions used in commands (#280), meaning $VAR is going to be interpolated in strings as well. This avoids context-switch when using both strings ("Hello %s".fmt("world")) and commands (var = "world"; `hello $var` ). You can now interpolate in strings with a simple var = "world"; "hello $var".

name = "alex""hello $name"
hello alex

Misc

ABS is now built using Go 1.13, which was released at the beginning of the month.

Don't miss a new abs release

NewReleases is sending notifications on new releases.