Releases: abs-lang/abs
v2.7.2
A fresh new patch release of ABS: always be shipping! 🚢
REPL irresponsive to ctrl+c
There's more to fix in the way commands are handled / interrupted, but for now we've made it so that the REPL will not hang when wanting to interrupt a command via ctrl+c
. The command will still be executed in background, but at least you gain control of the REPL back -- the long term fix will be in #519.
More build architectures
Architectures added:
- windows/amd64
- windows/arm
- darwin/arm64
Removed:
- linux/ppc64
- linux/ppc64le
v2.7.1
A fresh new patch release of ABS: always be shipping! 🚢
Allow string.split()
to split according to any whitespace
This may have been considered a breaking change as it changes existing behavior, but given the current behavior can be considered a bug, we opted to do a minor release.
From now on, split
's default separator will match any unicode whitespace.
Before:
> "hello world".split()
["hello", "world"]
> "hello\tworld".split()
["hello world"]
After:
> "hello world".split()
["hello", "world"]
> "hello\tworld".split()
["hello", "world"]
v2.7.0
A fresh new minor release of ABS: always be shipping! 🚢
It's been quite a while, and we couldn't take us being called abandonware (obviously, no hard feelings!). This release is mainly focused on a fresh new CLI, and a bunch of bugfixes.
New CLI
A GIF is worth a a thousand words:
The new CLI is based on bubbletea, and adds several improvements over the previous iteration:
- suggestions aren't based on identifiers anymore eg. the CLI can suggest functions, methods etc
- when suggesting an identifier or property, abs also includes its value so you can get a sneak peak before applying it
- suggestions are contextual eg. the cli won't suggest an array function if you're pressing tab on a string
- suggestions also include comments / doc
- a fully functional reverse-search: press
ctrl+r
, type your query and search through your history - colored output to simplify digesting whatever abs sends back to you
while
stack overflow
while
loops were previously implemented via recursion, which, well, could lead to a stack overflow.
Inconsistencies in for / while loops
More generally, while
and for
loops have been unified -- for
loops did not suffer from overflows, but because while
loops had their own implementation, there were bugs and inconsistencies. The implementation has been unified, considering for
is a superset of while
.
With this, we also fixed a bug where continue
was not working in while
loops.
for
compound assignments
Earlier on, for loops did not support compound assignments:
for x = 0; x+1; x += 1 {
...
}
This has been fixed.
stdin
scanning error
Previously, 2 iterations of stdin
counted as the same loop, meaning keys wouldn't be reset, due to our usage of a global scanner. This has been fixed.
Cleanups and Go 1.24
This version of ABS is built with the latest version of Go, 1.24, and drops CGO. We've also removed a bunch of deprecated calls (eg. ioutil).
v2.6.0
A fresh new minor release of ABS: always be shipping! 🚢
This is a small one, but we wanted to get defer
out of the way, after lying in our 2.6.x
branch for months.
Ability to defer
functions
Sometimes it is very helpful to guarantee a certain function is executed
regardless of what code path we take: you can use the defer
keyword for
this.
echo(1)
defer echo(3)
echo(2)
When you schedule a function to be deferred, it will be executed right at
the end of the current scope. A defer
inside a function will then
execute at the end of that function itself:
echo(1)
f fn() {
defer echo(3)
echo(2)
}
fn()
echo(4)
You can defer
any callable: a function call, a method or even a system
command. This can be very helpful if you need to run a cleanup function
right before wrapping up with your code:
defer `rm my-file.txt`
"some text" > "my-file.txt"
...
...
"some other text" >> "my-file.txt"
In this case, you will be guaranteed to execute the command that removes
my-file.txt
before the program closes.
Be aware that code that is deferred does not have access to the return value
of its scope, and will supress errors -- if a defer
block messes up you're
not going to see any error. This behavior is experimental, but we would most
likely like to give this kind of control through try...catch...finally.
What else has changed?
- Bump follow-redirects from 1.13.3 to 1.14.9 in /docs by @dependabot in #472
- Bump postcss from 7.0.35 to 7.0.39 in /docs by @dependabot in #471
- Bump minimist from 1.2.5 to 1.2.6 in /docs by @dependabot in #470
- Bump url-parse from 1.5.1 to 1.5.10 in /docs by @dependabot in #468
- Bump async from 2.6.3 to 2.6.4 in /docs by @dependabot in #473
- Bump prismjs from 1.23.0 to 1.27.0 in /docs by @dependabot in #467
Full Changelog: 2.5.2...2.6.0
v2.5.2
A fresh new patch release of ABS: always be shipping! 🚢
Upgrade to Go 1.18
Go 1.18 was released last month and ABS gets updated quickly 🙂
There are no major changes in the platform, but sometimes it's all about housekeeping! 🧹 ☁️
v2.5.1
v2.5.0
A fresh new minor release of ABS: always be shipping! 🚢
Added a negative membership operator !in
Earlier, you could test membership with x in list
, but in order to negate that expression you had to !(x in list)
which is quite verbose.
We now added in #412 the !in
operator to make things simpler: x !in list
, it behaves just like python's not in
.
Module cache
Every time you require
d a module, you'd always get a fresh instance of it, which would cause some funny behaviors:
$ require('@runtime').name = "xxx"
$ require('@runtime').name
abs
We now (#428) cache modules as soon as they are required, so the next time you require them you will receive the same instance you've required before:
$ require('@runtime').name = "xxx"
$ require('@runtime').name
xxx
This only applies to require
and not source
, as source
is intended to be used in order to always evaluate a block of fresh code in the current environment.
Specify your own shell
In #429 we added the ability to execute commands with any shell, not just bash -c
.
You can now specify a different shell to execute system commands with through ABS_COMMAND_EXECUTOR
:
`echo \$0` # bash
env("ABS_COMMAND_EXECUTOR", "sh -c")
`echo \$0` # sh
v2.4.2
A fresh new patch release of ABS: always be shipping! 🚢
Fixed parsing of numbers and their sign
By solving #409, we bring a little more stability and less funkiness in ABS' parser.
The way ABS used to parse prefixes (eg. -5) was kind of wonky:
we would dump in a token the whole prefix + number (-5) vs
parsing them separately and build the AST according to where
the minus token is found. This change makes it so -5 is actually
(-)(5)
.
Problems with the previous approach:
- inconsistent behavior between
x = 5; -x
and-5
-5
would be treated differently than- 5
- code such as
1 -1
would be parsed as(1); (-1)
, producing 2
statements. The return value would be -1 rather than 0
In general, I looked around and the common behavior is to read
tokens separately and, while parsing, figure out, based on their
position, what precedence they should have. This is what this PR
fundamentally does.
For example:
- when
-
is a prefix (-2
), it should have the highest precedence over
any other operator. For example,-2.clamp(0, 1)
should interpret as
(-2).clamp(0, 1)
- when
-
is not a prefix, it can fallback to its usual precedence (eg.
less than*
or/
)
Thie behavior is also consistent with other, languages, take ruby as an
example:
irb(main):011:0> -1.clamp(0, 10)
=> 0
One way in which ABS now deviates with other implementations
is that, since we do not bother reading whitespaces etc in our lexer
-1.clamp(0, 10)
and - 1.clamp(0, 10)
are exactly the same (while
in ruby, for example, the latter is intepreted as (-)(1.clamp(0, 10))
). I think for now this is a reasonable compromise, but I'm open
to change this behavior in subsequent versions of ABS.
This PR also fixes a couple additional issues:
+2
is now a valid number, earlier we only considered-
as the only
valid prefix for numbers- there could be instances where an infinite loop would be triggered
because of ABS parsingx +y
asx; +y;
where the return value is just
+y
. A for loop written like this would have triggered the bug:decr = f(x) {x -1}; for x = 0; x > -10; x = decr(x)
. It would only happen on for loops where our looper is decrementing
v2.4.1
v2.4.0
A fresh new minor release of ABS: always be shipping! 🚢
array.shuffle()
We've introduced a new array.shuffle()
function:
⧐ [1,2,3,4,5].shuffle()
[4, 5, 3, 2, 1]
array.reverse() operates on a copy of an array
We're in the process of making sure that functions that mutate arrays always operate on a copy of the array. This is somewhat of a breaking change but it also introduces an "expected" behavior (we align with Ruby here). You can expect other updates, in ABS 1.5, to align other array / string functions to this behavior.
Prior to this change:
⧐ a = [1,2,3,4,5]
⧐ a.reverse()
[5, 4, 3, 2, 1]
⧐ a
[5, 4, 3, 2, 1]
After this change:
⧐ a = [1,2,3,4,5]
⧐ a.reverse()
[5, 4, 3, 2, 1]
⧐ a
[1, 2, 3, 4, 5]
If you have older code that relies on mutating arrays in-place, you could migrate from x.reverse()
to x = x.reverse()
.