ABS 1.1.0 released: more Python and Bash for the most fun programming language out there

Fresh new release of the ABS programming language, bringing more syntax you should be familiar with, inspired both by Bash and Python.

This release includes 8 new features and 2 bugfixes, let’s discover them together!

Better membership testing

The membership testing operator, in, now supports finding whether an object has a particular key as well as it allows to find substrings in strings:

1
2
3
4
5
some in {"some": "thing"} # TRUE
some in {} # FALSE

"str" in "string" # TRUE
"hello" in "string" # FALSE

With these changes to in we are now deprecating the set.includes(member) function:

1
2
"string".contains("str")
[1, 2, 3].contains(2)

The function will keep working but, again, is deprecated. We will likely not remove it from future releases (even major ones) but… …you’re warned!

1 ~ 1.1

The similarity operator, ~, now supports numbers:

1
2
1 ~ 1.23 # TRUE
1 ~ 0.99 # FALSE

Numbers will be similar if their integer conversion is the same. This is a shorthand for:

1
2
1.int() == 1.23.int() # TRUE
1.int() ~ 0.99.int() # FALSE

for .. in

We’ve made a few changes to for .. in to make it more useful, as you can now loop through hashes:

1
2
3
4
for k, v in {"some": "thing"} {
    # k is some 
    # v is thing 
}

More destructuring

We introduced destructuring before ABS was stable, updated it right before 1.0 and we’ve now expanded it to be able to destructure hashes:

1
2
some, thing = {"some": 1, "thing": 1}
some + thing # 2

Backtick commands

My absolute favorite feature in this release is the ability to execute commands with the backtick shell syntax:

1
2
3
4
`ls -la`

# previously you could only do
$(ls -la)

There are some limitations with the $() syntax (namely, a command needs to be on its own line) that are not there anymore with backticks. Now you can do things such as:

1
2
3
4
5
6
if `somecommand`.ok {
    ...do something...
}

# This is not possible, $() needs its own line
$(somecommand).ok

The same interpoltion style available with $() is working with backticks:

1
2
arg = "-la"
`ls $arg`

sleep(ms)

Well…every language has one!

You can now pause execution of a script by sleeping for a certain amount of milliseconds:

1
2
3
echo("This will be printed immediately")
sleep(10000)
echo("This will be printed in 10s")

Hash built-in functions

With this release we’ve added a bunch of new built-in functionalities to hashes:

1
2
3
4
5
6
hash = {"a": 1, "b": 2, "c": 3}

hash.keys() # ["a", "b", "c"]
hash.values() # [1, 2, 3]
hash.items() # [["a", 1], ["b", 2], ["c", 3]]
hash.pop(a) # hash is now {"b": 2, "c": 3}

NULL comparison

In ABS 1.0.0 we introduced a bug that would make NULL comparison fail:

1
null == null # FALSE

In 1.2.0 we fixed it (and backported it to 1.0.2).

Index assignments

Assigning to the index of an hash / array now works:

1
2
3
4
5
6
array = []
array[0] = 1 # array is now [1]
array[5] = 1 # array is now [1, null, null, null, null, 1]

hash = {}
hash.x = 1 # hash is now {"x": 1}

What are you waiting for?

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

…and start scripting like it’s 2019!

PS: Again, many thanks to Erich, who’s been helping me along the way and has become a crucial member of the team over the past few weeks. Just want to make sure his name is mentioned as most of this stuff would not have been possible without him!

PPS: 1.2.0 is already well underway — expect it within the next 2 to 3 weeks. We’ll be introducing extremely interesting features such as background commands and REPL history, so it’s going to be an exciting release!


In the mood for some more reading?

...or check the archives.