Skip to content

v2.2.2

Compare
Choose a tag to compare
@odino odino released this 28 Jul 14:38
· 104 commits to master since this release

This release fixes a bug with parsing negative numbers (#385): before, -10 would be parsed as (minus, number) whereas
right now it's going to be parsed as (number) only.

This fixes a bug with precedences, where -1.str() would be parsed as (-, (1, str)), leading to first calling the str method on the positive number, then applying the minus.

Before:

⧐  -1.234.str()
ERROR: unknown operator: -STRING
	[1:1]	-1.234.str()

After:

⧐  -1.234.str()
-1.234

If a space is found between the minus and the number, the old parsing mechanism still applies.

It's inspired by Ruby, where:

$ - 1.to_s()
-@: undefined method `-@' for "1":String

$-1.to_s()
-1

$ -10.3.floor()
-11

$ - 10.3.floor()
-10

In addition, the documentation for strings has been improved (#384).

Thanks to @gromgit both for finding the bug as well as improving the documentation ❤️