ABS 1.3.2: making ABS faster with a simple fix

Hi there! Just a quick post to announce a bugfix release of the ABS programming language: 1.3.2 fixes a simple yet important performance bug dealing with short-circuit evaluation.

Short-circuiting is the amazing property some languages assign to boolean operators (eg. && or ||): if the first parameter in the expression is sufficient to determine the end value of the expression, the second value is not evaluated at all.

Take a look at this example:

1
false && sleep(a_really_long_time)

You wouldn’t expect the script to sleep since the first parameter in the expression is already falsy, thus the expression can never be truthy.

What about:

1
true || sleep(a_really_long_time)

Same thing, easy peasy.

Even more important, short-circuiting can be really useful in order to access a property when not sure whether it exists:

1
2
# we don't know whether X is null or what
x && x.property

Compare that to what you’d usually have to write:

1
2
3
4
5
6
# we don't know whether X is null or what
if x {
    return null
}

return x.property

You might be wondering what does all of this have to do with ABS: well, we were supposed to have fully working short-circuiting but, as it turns out, there was a bug preventing this from working. Your code would work and run successfully, but it would always evaluate all the arguments of an expression, even if it short-circuited. In some cases (like when using short-circuiting for accessing properties) your code would crash — defeating the whole purpose of short-circuiting.

Luckily, Ming fixed this in #227 and the fix got backported to the 1.3.x branch: 1.3.2 is served!

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!


In the mood for some more reading?

...or check the archives.