Skip to content

Releases: abs-lang/abs

v1.8.0

20 Sep 09:44
Compare
Choose a tag to compare

A new minor release of ABS: always be shipping! 🚢

ABS 1.8.0 brings a bunch of interesting features and bugfixes, spearheaded by the module installer that lets you download ABS modules with a simple abs get github.com/user/repo!

The ABS module installer

ABS is now bundled with a very simple module installer (#277). What the installer does is to fetch an archive from Github and place it under a vendor/ directory. You can use it by running abs get $ARCHIVE, where archive is a github repository URL in the form github.com/user/repo.

See it in action:

asciicast

Once a module is installed, it will also be aliased in a file called packages.abs.json:

{
    "abs-sample-module": "./vendor/github.com/abs-lang/abs-sample-module-master"
}

You can then require the module either through its full path or the alias, both will work. The alias, though, is there to make it easier for you. Please note that when you call require(path), a valid ABS file needs to be present at path, or path should be a directory containing an index.abs file. This is very similar to NodeJS' require mechanism.

Unfortunately, having to bundle the installer means the ABS distribution just got a little heavier, from 2 to around 5 MB. In the world of 5G, though, this shouldn't be a huge problem.

Negative indexes

You can now specify negative (#276) indexes to access array elements! Want to grab the last element of an array without having to know its length?

list = [1,2,3,4]
⧐  list[-1]
4

array.tsv()

We've added a very useful functionality to arrays, which is the ability to convert them into TSV/CSV output:

⧐  list = [["name", "age", "sport"], ["LeBron", "34", "basketball"], ["Virat", "30", "cricket"]]
⧐  list.tsv()
name	age	sport
LeBron	34	basketball
Virat	30	cricket
⧐  list.tsv(",")
name,age,sport
LeBron,34,basketball
Virat,30,cricket

You can specify a separator to be used, so CSV is supported out of the box. We rely on encoding/csv for this feature (#282).

Bash-style interpolation in strings

Interpolation in strings now follows the same conventions used in commands (#280), meaning $VAR is going to be interpolated in strings as well. This avoids context-switch when using both strings ("Hello %s".fmt("world")) and commands (var = "world"; `hello $var` ). You can now interpolate in strings with a simple var = "world"; "hello $var".

name = "alex""hello $name"
hello alex

Misc

ABS is now built using Go 1.13, which was released at the beginning of the month.

v1.7.0

20 Aug 15:15
Compare
Choose a tag to compare

A new minor release of ABS: always be shipping! 🚢

ABS 1.7.0 introduces some syntactical sugar as well as improvements to the REPL, so let's check these changes out!

Reverse search in the REPL

You can now use ctrl+r to look for previously ran commands in the REPL (#265), have a look at this video:

asciicast

Number abbreviations

You can now abbreviate numbers through these letters (#269):

  • k (thousand)
  • m (million)
  • b (billion)
  • t (trillion)
1m / 2k # 500

The abbreviations are case-insensitive.

Output an exit message when terminating a script

You can now output a "goodbye" message when exiting a script (#266):

exit(1, "something nasty happened")

Earlier you had to explicitly echo right before exiting:

echo("something nasty happened")
exit(1)

This message argument to exit(...) is optional.

Improvements to str.replace(...)

We have made a couple of changes to improve the str.replace() function:

  • you do not have to specify the number of replacements anymore, as the default value is "all replacements": "abcabc".replace("a", "x") # "xbcxbc" (#268)
  • you can replace a list of characters now: "121".replace(["1", "2"], "x") # "xxx" (#267)

The ABS playground

This is not really specific to this version, but we launched a playground for you to test ABS code directly on the website:

image

v1.6.2

19 Aug 07:03
Compare
Choose a tag to compare

This version fixes a bug introduced in 1.6.0 with index ranges that, under certain conditions, could cause a panic or return the wrong range (#270).

v1.6.1

05 Aug 18:43
Compare
Choose a tag to compare

This is a bugfix release that fixes #258, introduced in 1.6.0.

v1.6.0

04 Aug 14:48
Compare
Choose a tag to compare

A new minor release of ABS: always be shipping! 🚢

In this release, we've introduced 2 new features, as well as deprecated some of the initial syntax for executing system commands.

New features

  • index ranges have landed! ✈️ You can now slice strings and arrays just like in Python or Ruby: "string"[0:3] will return str. Negative right index ranges mean take elements up to len() - index, so "string"[:-2] will return "stri" (#255)
  • we now have implicit return values (#219) which default to null: in earlier versions of ABS, you always had to specify a value after a return statement, while right now you don't: if x { return } will, for example, evaluate to null if x is truthy

Misc

  • the initial $(command) syntax for executing bash commands has been deprecated (#254) in favor of backticks `command`. $() can still be used, and it proves useful when nesting commands $(some $(other $(command)))

v1.5.1

28 Jul 07:47
Compare
Choose a tag to compare

This release fixes a bug in interpolating numerical bash arguments (eg. $0), reported in #248 and fixed with #249:

⧐  `echo \$0`
bash

(an empty string would have been returned before this fix)

v1.5.0

16 Jul 16:21
Compare
Choose a tag to compare

Welcome to a brand new release of the ABS programming language: in this version we've introduced file writers, break/continue and made for..in loops 30% faster!

New features

  • file writers: > and >> let you write to a file when in between 2 string arguments, such as "text" > "file.ext". > truncates and writes while >> appends (#245)
  • [].unique() allows you to obtain unique values from an array (#247)
  • break and continue can now be used inside for and for..in loops (#244)

Bugfixes

  • fixed a stack overflow that would happen on large for..in loops (> 1M elements): the original implementation of for..in naively used recursion, so we simply switched to a regular loop. With this change, for..in loops are also up to 30% faster (#246)

Misc

  • happy to say that ABS' executables are now 25% lighter thanks to using the right ldflags during the Go build process -- builds are now between 2 and 3 megabytes

v1.4.1

07 Jun 14:19
Compare
Choose a tag to compare

This is a bugfix release that fixes the ability to negate membership expressions if !(1 in [2,3,4]) {...} through #240.

This bug has affected ABS since membership testing was introduced. Workaround for previous versions:

if 1 in [] {

} else {
  // execute your code here
}

While from 1.4.1 you can:

if !(1 in []) {
  // execute your code
}

v1.4.0

06 Jun 19:33
Compare
Choose a tag to compare

Welcome to a brand new release of the ABS programming language! In this edition: unicode, eval and loads of additional goodies!

Features

  • unicode support, both in code as well as strings! 🎉 🎉 🎉 You can now use any unicode character in a variable name (世界 = 1) and include unicode (and emojis! ❤️) in strings (echo("I ❤ ABS"))
  • added the built-in function eval that allows you to evaluate ABS code on-demand (#235). Try it with eval("1 + 1") or, even more fun: eval(stdin()) from the REPL
  • now you can include digits in variable names, such as v4r14bl3 = 1 (#237)
  • readability counts 👓 so we've decided to support numeric separators: you can include underscores in numbers to make them more readable, like 1_000_000 (#215)

Bugfixes

  • fixed a panic that would occur under very specific circumstances, when you would start the REPL without a terminal attached (#234)
  • quotes were not escaped properly when converting hashes to JSON, like {"hello": "wo\"rld"} (#224)
  • fixed a panic when trying to convert an empty string to json (#226)

Misc

  • the ABS codebase had been migrated to using go modules (#216)

Thanks

A big thank you to @mingwho who killed it this round -- she was responsible for most of this release!

v1.3.2

29 May 08:33
Compare
Choose a tag to compare

This is a bugfix release that backports #227 to 1.3.x (it was originally merged in 1.4.x): we have fixed lazy evaluation so that code such as false && sleep(10000) will return immediately rather than wait 10 seconds.

This fundamentally fixes a flaw in ABS' short-circuiting logic, so programs that make use of short-circuiting should perform significantly faster.