I just released the preview-3 version of ABS, a terse, pragmatic scripting alternative to Bash. This release is geared towards cleaning up bugs before 1.0, so I thought I’d spend some time going through the changes.
Backward-incompatible changes
We got 1 of them!
I first thought of implementing array destructuring with the very same syntax JavaScript uses:
1
|
|
but this created a few issues with ABS’ parser. For example, when executing code such as:
1 2 |
|
the parser would see x = 10[y]
, and throw a truckload of
errors. A simple fix was to add a semicolon on the line
right before a destructuring statement:
1 2 |
|
Now, considering I had to fix this as well as the fact that I’m always aiming to keep the language as terse as possible, I took some inspiration from Ruby and refactored destructuring to resemble Ruby’s multiple assignments.
In order to destructure an array, you will now have to:
1
|
|
Easy peasy, with the added bonus of less typing!
Features
Only 1 new feature in this release of ABS: bitwise operators.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Bugfixes
Here’s where the bulk of changes happened:
null
is now an “assignable” value. Earlier on, you couldn’tx = null
, which resulted in funny behaviors such as #85- numbers are not following scientific notation: for very large numbers, the formatter used to convert them to something like
1e+06
. This has been now fixed. - fixed a panic when using
.map(...)
without return values (#62) - fixed a panic when calling functions without enough arguments (#61)
- beautified a panic when trying to execute a script that does not exist (#77)
- beautified a panic when trying to execute
.sum()
on an array with elements other than numbers (#75) - fixed error handling in
.map()
and.filter()
(#80) - fixed script halting when there was an error in a while block (#82)
- added
\r
and\f
as a separator for.lines()
- strengthened the command parser (#78)
- fixed shell command escaping (#81)
- destructuring statements do not need a
;
on the preceding line anymore (#83)
In other news…
Travis-ci recently launched Windows builds, so I took the opportunity to configure ABS’ builds on Linux, OSX and Windows (#88).
What next?
Ever hoped a bash script could look like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Hope no more! Simply
1
|
|
and start hacking like it’s 2018!