Repository navigation
Finch 2.4.0: macOS, ARM64, methods, maps, errors as values
Finch now runs on macOS and ARM64, and gets three things real programs need: methods, maps and errors as values.
Platforms
- macOS (Apple Silicon):
finch-macos-arm64.tar.gzbelow (needsbrew install llvm@21). Apple frameworks:import "OpenGL/gl.h",link "Cocoa.framework". - Linux ARM64 (Raspberry Pi 4/5, Graviton, …):
finch-linux-arm64.tar.gz; alsofinch-linux-x64.tar.gz. Both need LLVM 21's libraries (libllvm21 libclang1-21from apt.llvm.org). - C structs by value follow AAPCS64 on ARM64 (float aggregates in vector registers, Apple's variants included).
- Cross-building:
--target arm64(runs with QEMU),--target macos,--target windows. - CI builds and tests everything natively on Linux x86-64, Linux ARM64, macOS ARM64 and Windows: 74 tests each.
Language
struct Counter {
map[str]int counts
}
fn Counter.add(str word) { // a method: self is the caller's Counter, not a copy
self.counts[word] += 1 // a missing key starts at 0
}
fn parse_port(str s) -> int! { // ! = can fail
n := int(s) or { return error("not a number: " + s) }
return n
}
fn main() -> ! {
port := parse_port("80") or 8080
text := try read_file("words.txt")
...
}- Methods:
fn Point.move(int dx) { self.x += dx },p.move(3); also on structs from C headers. - Maps:
map[K]V,["a": 1],m[k],has,get(k, default),remove,keys,values,for k, v in m; insertion order is kept. - Errors as values:
-> T!/-> !,return error("..."), thenor <value>,or { ... err ... }ortry. Forgetting to handle a failure is a compile error.int(s),float(s),read_file,write_file,delete_filework withor/trytoo.fn main() -> !prints the error and exits with 1. for i, x in list;str(x)works for arrays, maps and structs (the same textprintshows).- New example:
examples/wordcount.fch.
Editors
- Kate (and KWrite/KDevelop): highlighting and language server setup in
editors/kate(install.sh). - The language server completes struct methods and map methods and shows method signatures.
- VS Code extension 2.4.0 (
finch-lang-2.4.0.vsixbelow): new highlighting and snippets.
Docs
All three guides (beginners, technicians, engineers) and the cheat sheets, in English and Polish, cover the new features and platforms.