ABS preview-4: as the language matures, the features keep coming!

Thanks to a few contributions, I got around to releasing another preview of ABS, the dynamic and modern language for shell scripting.

First and foremost: a huge thank you to nicerobot and ntwrick who managed to take a crack at some of the pain points I didn’t manage to have a look at myself — their contributions added some interesting features to the language and I can only hope they’ll keep coming!

Let’s now run throgh the most notable changes in this new release.

Features

The most important “feature” of this release is the ability, for ABS, to help you locate parsing and execution errors by pin-pointing the code that causes the error, including the line and column number:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$ cat tests/test-eval.abs 
# eval fails

test_num = int(arg(2))

if test_num == 1 {
    # mismatched type
    s = "string"
    s = s + 1   # this is a comment
}

if test_num == 2 {
    # invalid property
    a = [1,2,3]
    a.junk
}

if test_num == 3 {
    # invalid function as index
    {"name": "Abs"}[f(x) {x}];  
}

$ abs tests/test-eval.abs 1
ERROR: type mismatch: STRING + NUMBER
  [8:11]      s = s + 1   # this is a comment

$ abs tests/test-eval.abs 2
ERROR: invalid property 'junk' on type ARRAY
  [14:6]      a.junk

$ abs tests/test-eval.abs 3
ERROR: index operator not supported: f(x) {x} on HASH
  [19:20]     {"name": "Abs"}[f(x) {x}];

You can now also access command line flags passed to your script with the flag(...) function:

1
2
3
4
5
6
7
8
9
10
$ abs --foo=1 --bar 2 --baz
Hello user, welcome to the ABS (preview-4) programming language!
Type 'quit' when you're done, 'help' if you get lost!
⧐  flag("foo")
1
⧐  flag("bar")
2
⧐  flag("baz")
true

Other small additions:

Bugfixes

What are you waiting for?

Grab the latest release for your platform, dump it in your path and start hacking with ABS!

If you’re brave enough, just:

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

Adios!


In the mood for some more reading?

...or check the archives.