Skip to content

Jamo 0.3.0

Choose a tag to compare

@jamolang jamolang released this 27 Nov 00:14
· 25 commits to main since this release

Jamo 0.3.0 is the biggest update yet. Programs can now recover from mistakes instead of crashing, functions can be passed around like any other value, and you can download libraries other people share.

Get started

  1. Download jamo-0.3.0-windows.zip below, unzip it anywhere, and double-click install.cmd.
  2. Open a new terminal and type jamo version. It should say Jamo 0.3.0.
  3. Try a game: jamo run examples\beat_run.jamo from inside the unzipped folder.

Already have 0.2.0? Just run the new install.cmd. It replaces the old jamo.exe, and your own programs stay as they are.

For colors, red underlines and the new hover help in VS Code, download jamo.vsix below. In VS Code, open the Extensions panel, click the ... menu at its top, and choose Install from VSIX.

What's new

Catch mistakes instead of crashing

Before, one bad number or missing file stopped the whole program. Now you can say what to do instead:

try
    var age = int(typed)
    print(f"Next year you'll be {age + 1}")
catch problem
    print("That wasn't a number: " + problem)
end

It works even when the mistake happens deep inside other functions. Guide section 28 explains it.

Pass functions around

A function's name, without ( ), can now be stored, put in a list, or handed to another function:

func by_score(a: Player, b: Player): bool
    return a.score > b.score
end

sort_with(players, by_score)       # highest score first

list.jamo has three new helpers that take a function of your own: sort_with (sort by your own rule), filtered (keep the items you choose) and mapped (change every item). A struct can hold a function too, which is handy for buttons: button.on_click(3). Guide section 29.

Download libraries other people share

jamo get someone/project

downloads a shared library from GitHub into a packages folder and tells you the use line to write. To share your own, see guide section 24.

Two new games to play and learn from

  • Sky Hopper: a three-level platformer with springs, spikes and coins (examples\platformer.jamo).
  • Beat Run: a one-button rhythm game whose whole song is made in code (examples\beat_run.jamo).

Smaller things

  • Sort any list: sort_by(items, keys) sorts by numbers or text you give each item.
  • Letters beyond English: upper and lower now handle accented, Greek and Cyrillic letters, and letter_count counts real letters instead of bytes.
  • Make music in code: silence(seconds) and clip.mix(...) build whole songs from notes, which is how Beat Run's song is made.
  • VS Code: hover over a name to see what it is, and Ctrl+click to jump to where it's made.
  • Clearer errors, like "which has 1 item" instead of "1 items".

Good to know

  • try and catch are new keywords, so a variable can't be called try or catch any more.
  • Function values can't remember the variables around them (there are no closures yet). Pass what they need as inputs.
  • Windows may warn about new programs it hasn't seen before. Click More info, then Run anyway.

The full list is in CHANGELOG.md.