Repository navigation
Jamo 0.8.0 is a big one: enums that carry values, a package list, tasks that run side by side, a smarter debugger, rename-everywhere in VS Code, and loops that now beat C at one benchmark.
Get started
- Download jamo-0.8.0-windows.zip below, unzip it anywhere, and double-click install.cmd.
- Open a new terminal and type
jamo version. It should sayJamo 0.8.0. - Try a package:
jamo packages, thenjamo get tween.
Already have an older Jamo? Just run the new install.cmd. Your own programs stay as they are.
For 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
Enums that carry values
A member can carry values of its own, and match takes them out again:
enum Shape
CIRCLE(radius: float)
RECT(width: float, height: float)
EMPTY
end
func area(shape: Shape): float
match shape
case Shape.CIRCLE(r)
return 3.14 * r * r
case Shape.RECT(w, h)
return w * h
case Shape.EMPTY
return 0.0
end
end
_ skips a value you don't need, and a member can carry the enum it's in, so trees are easy: NODE(left: Tree, right: Tree). They print as Shape.CIRCLE(2.0), can have their own functions like structs, and the debugger opens them up.
Tasks: several jobs at once
use "tasks.jamo"
func main()
spawn(func() => count("cat", 3))
spawn(func() => count("dog", 2))
wait_all()
end
next_turn(), wait_seconds(0.5), wait_until(...) and wait_all() let other tasks run. They take turns on one processor core, so there's nothing to lock, and while every task waits the program sleeps without using the processor. Great for games, timers and downloads.
A package list
> jamo packages
tween Easing curves and tweens for smooth movement in games (jamolang/tween)
> jamo get tween
Got 1 file from jamolang/tween into packages/tween
Use it with: use "packages/tween/tween.jamo"
The list lives on GitHub at jamolang/packages, so there's no server. Made a library? Add it with a pull request.
A smarter debugger
- Open structs and arrays as deep as you like. In VS Code, click the arrow by one in the Variables panel. In the console,
p hero.pos.xandp items[2]. - It stops on a crash, on the crashing line, with every variable as it was. VS Code shows it as an exception.
- Inside a function written in place, it shows the variables it uses from around it, and functions stored in variables show by their name instead of
(lambda 1).
VS Code: find and rename
Shift+F12 finds every use of a function, struct, field, method, enum member, constant or variable, across every file of a program. F2 renames it everywhere at once, leaving text in quotes and comments alone.
Faster
if n % 3 == 0 now checks with one multiply instead of working out the remainder. The 100-million-step loop benchmark went from 0.066 s to 0.046 s, ahead of C compiled with gcc -O2 (0.056 s).
Built carefully
- Both of Jamo's compilers make byte-for-byte the same
.exe, and the Jamo-written one still builds itself the same every time. - Tasks were stress-tested in all six memory-cleaner modes, and a version with the cleaner's new stack check switched off crashed the test, so the check is proven to matter.
- The divisibility shortcut was checked against plain math for every divisor up to 400 and the biggest and smallest ints.
- The whole test suite passed after each change, and every code sample in the guide is built and run by the tests.
Good to know
- A struct or enum from a file used with
asnow prints without the file's name, likeBox{size: 2}. jamo get,jamo packagesandjamo debugwork injamo.exe, not in the C++ backup compiler.- Windows may still warn about a program it has never seen before. Click More info, then Run anyway.
The full list is in CHANGELOG.md.