Skip to main content

ยท 2 min read

Improvementsโ€‹

Add JSON Literalโ€‹

It is now possible to parse a string via the JSON literal and creating an RocketLang object (array or hash) from it.

๐Ÿš€ > JSON.parse('{"test": 123}')
=> {"test": 123.0}

๐Ÿš€ > JSON.parse('["test", 123]')
=> ["test", 123.0]

See JSON for more information.

Support for Single Quotes (')โ€‹

You can now use single-quotes to create a string additionally to the already existing double-quotes. This allows more flexibility in creating rich content like json.

'test "string" with doublequotes'

Escape double-quotes in double-quoted stringโ€‹

caution

This feature is in an early beta stage and does not support other escape sequences

Insinde a string created with double-quotes " you can escape a single double-quote to create strings more flexible.

"te\"st" == 'te"st'

Removedโ€‹

next and break argumentโ€‹

This version removes the ability in break and next to submit an argument as it did not work reliable and intuitive.

In order to update your program to this version you need to make the following adjustments:

foreach i in 5
if (i == 2)
next(i)
end
puts(i)
end

foreach i in 5
if (i == 2)
break(i)
end
puts(i)
end

needs to change to:

foreach i in 5
if (i == 2)
next
end
puts(i)
end

foreach i in 5
if (i == 2)
break
end
puts(i)
end

ยท One min read

Improvementsโ€‹

Introduce NIL Objectโ€‹

Up to this version some functions were returning NULL. No a proper NIL object has been added which replaces all existing NULLs and is now also createable like every other object by the user.

See NIL for more information.

Removedโ€‹

NULL has been replaced by NILโ€‹

As stated above, NIL is replacing NULL.

ยท 2 min read

Featuresโ€‹

HTTP builtin addedโ€‹

The HTTP builtin has been added which allows to create a builtin webserver and handle incoming requests.

See HTTP for more information.

Add Ability to marshal Objects to JSON Stringsโ€‹

You can now use .to_json() to various objects in order to convert them to their JSON respresentation.

See JSON for more information.

Support for Next and Breakโ€‹

Within a loop you can now use break and next for complex control flows.

foreach i in 5
if (i == 2)
next("next")
end
puts(i)
end

foreach i in 5
if (i == 2)
break("break")
end
puts(i)
end

// Returns

0
1
3
4
0
1
"break"

Allow String Multiplicationโ€‹

Support for repeating a string by a given number using the * operator has been added.

๐Ÿš€ > "test" * 2
=> "testtest"

Allow Integer Iterationโ€‹

info

Contribution by RaphaelPour

An Integer can now be iterated.

๐Ÿš€ > foreach i in 5 { puts(i) }
0
1
2
3
4
=> 5

Support for Modulo Operatorโ€‹

Modulo has been added as valid operator.

๐Ÿš€ > 5 % 3
=> 1

Support for Ternery Operatorโ€‹

It is now possible to use the ? operator.

๐Ÿš€ > 4 > 3 ? true : false
=> true

While Loopโ€‹

info

Contribution by MarkusFreitag

Support for while has been added.

๐Ÿš€ > a = 0
๐Ÿš€ > while (a != 4)
puts(a)
a = a + 1
end
// which prints
0
1
2
3
=> nil

Improvementsโ€‹

Add Shorthand to convert Float to Integerโ€‹

info

Contribution by RaphaelPour

The .plz_i() method has been added to the Float object.

๐Ÿš€ > a = 123.456
=> 123.456
๐Ÿš€ > a.plz_i()
=> 123

Fix Object Index and add support for Index Rangeโ€‹

info

Contribution by MarkusFreitag

The index operator [] has been fixed for many objects and now supports also ranges.

a = [1, 2, 3, 4, 5]
puts(a[2])
puts(a[-2])
puts(a[:2])
puts(a[:-2])
puts(a[2:])
puts(a[-2:])
puts(a[1:-2])

// should output
[1, 2]
[1, 2, 3]
[3, 4, 5]
[4, 5]
[2, 3]
[1, 2, 8, 9, 5]

Return written bytes on FILE.writeโ€‹

If you write to a file it now returns the written bytes instead of true.

Removedโ€‹