Skip to main content

RocketLang v0.22.0 is released

ยท 3 min read

We're excited to announce RocketLang v0.22.0, featuring significant improvements to array handling, better error messages, and the introduction of the rocket-range syntax for loops.

Breaking Changesโ€‹

caution

This release includes breaking changes to array method names.

Array Method Renames: .yeet() and .yoink() โ†’ .pop() and .push()โ€‹

To improve code readability and align with common programming conventions, we've renamed the array manipulation methods:

  • .yoink() is now .pop() - Removes and returns the last element
  • .yeet() is now .push() - Adds an element to the end

Before (v0.21.x and earlier):

a = [1, 2, 3]
a.yeet(4) // Add element
last = a.yoink() // Remove last element

Now (v0.22.0):

a = [1, 2, 3]
a.push(4) // Add element
last = a.pop() // Remove last element

While the old names were fun, the new names are more intuitive for developers familiar with other programming languages.

New Featuresโ€‹

Array .sum() Methodโ€‹

Calculate the sum of numeric array elements with the new .sum() method:

numbers = [1, 2, 3, 4, 5]
total = numbers.sum() // Returns 15

mixed = ['1', 2, 2.5]
mixed.sum() // Returns 5.5 (strings are converted)

The method handles integers, floats, and numeric strings automatically.

Array .join() Methodโ€‹

Join array elements into a string with an optional separator:

words = ["Hello", "RocketLang", "World"]
words.join() // Returns "HelloRocketLangWorld"
words.join(" ") // Returns "Hello RocketLang World"
words.join(", ") // Returns "Hello, RocketLang, World"

numbers = [1, 2, 3]
numbers.join("-") // Returns "1-2-3"

Rocket-Range Syntaxโ€‹

Introduce cleaner range syntax for foreach loops with the new rocket-range operator (->):

// Exclusive range (0 to 4)
foreach i in 0 -> 5
puts(i)
end

// Inclusive range (0 to 5)
foreach i in 0 => 5
puts(i)
end

// With stepping using the ^ operator
foreach i in 0 -> 10 ^ 2
puts(i) // 0, 2, 4, 6, 8
end

See Foreach for more information.

Improvementsโ€‹

Enhanced Error Messagesโ€‹

Error messages now include precise file:line:pos information, making debugging much easier. You'll see exactly where errors occur in your code with accurate line and position information.

Type Conversion Refactoringโ€‹

Internal type conversion methods have been refactored for better consistency and reliability across different object types.

Bug Fixesโ€‹

break Support in while Loopsโ€‹

The break statement now works correctly in while loops, contributed by MarkusFreitag in PR #168.

i = 0
while i < 10
if i == 5
break
end
puts(i)
i = i + 1
end

Infrastructure Updatesโ€‹

Go 1.21โ€‹

RocketLang now uses Go 1.21, bringing performance improvements and the latest language features.


Check out the full changelog for a complete list of changes and contributors.