A few hours ago I released a new minor version of the ABS programming language, 1.5.0, which includes a couple of interesting features — let’s get to them!
File writers
Probably one of the most exciting things coming out of this release
are file writers: >
and >>
.
1 2 3 4 5 6 7 8 9 10 11 |
|
These operators work as file writers when both the left and right
arguments are strings, and proceed to either truncate and write
(>
) or append (>>
).
[].unique()
Arrays now have a .unique()
method, used to filter out
duplicated elements:
1
|
|
An element is considered duplicate if both its type and string representation match:
1
|
|
For example, different hashes with the same content are considered duplicates:
1 2 3 |
|
Break and continue in for loops
We finally implemented break
and continue
within for loops: earlier on you could use return
to exit a loop but it always felt a tad awkward —
with this release this has been fixed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
for..in stackoverflow
We also fixed a bug that resulted in a stack overflow when looping
a high number of times in a for..in
loop:
1 2 3 |
|
This has been fixed. As a bonus point, for..in
loops are
also significantly faster with this change (especially noticeable
on larger loops, at around 30% faster):
1 2 3 4 5 6 7 8 9 10 |
|
Now what?
Install ABS with a simple one-liner:
1
|
|
…and start scripting like it’s 2019!