Jennifer for coders

Jennifer

You already program in another language. This is what is different here, and why.

by @mplx

1 / 17

The language in one slide

2 / 17

Three kinds of names

use io;

def const LIMIT as int init 3;
def count as int init 0;

func bump(n as int) {
    return $n + 1;
}

$count = bump($count);
io.printf("%d of %d\n", $count, LIMIT);
3 / 17

Strict by default

$ jennifer run sum.j
sum.j: runtime error at /home/ada/sum.j:2:19: operator + requires numeric operands, got string and int
use io;
use convert;

def n as int init convert.toInt("42");
io.printf("%d\n", $n + 1);
4 / 17

Numbers that do not lie

ExpressionResult
7 / 23.5: / is always float division
7 // 23: floor division
-7 % 32: floored, to match //
9223372036854775807 + 1error: integer overflow
1e308 * 10.0error: no infinity, no NaN
5 / 17

Strings: cooked, raw, and sliced

use io;

def word as string init "Jennifer";
io.printf("%s\n", $word[0..3]);
def pattern as string init '\d+\.\d+';
io.printf("%d chars, {$word}\n", len($pattern));
Jen
8 chars, Jennifer
6 / 17

Assignment copies

use io;

def a as list of int init [1, 2, 3];
def b as list of int init $a;
$b[] = 4;
io.printf("%d %d\n", len($a), len($b));
3 4
7 / 17

Structs, enums and match

use io;

def enum Shape { Circle { r as float }, Rect { w as float, h as float } };

func area(s as Shape) {
    match ($s) {
        when Circle(c) { return 3.14159 * $c.r * $c.r; }
        when Rect(r) { return $r.w * $r.h; }
    }
}

io.printf("%f|prec=2\n", area(Shape.Rect{w: 2.0, h: 1.5}));
8 / 17

Errors are values

use io;

func work() {
    defer io.printf("cleanup\n");
    throw Error{kind: "io", message: "disk full"};
}

try {
    work();
} catch (e) {
    io.printf("caught %s: %s\n", $e.kind, $e.message);
}
9 / 17

Functions are values

use io;
use lists;

func isEven(n as int) { return $n % 2 == 0; }
func square(n as int) { return $n * $n; }

def xs as list of int init 1..7;
def out as list of int init lists.map(lists.filter($xs, isEven), square);
io.printf("{$out}\n");
[4, 16, 36]
10 / 17

Libraries, modules and decks

export def const EARTH_KM as float init 6371.0;

export func circumference(r as float) {
    return 2.0 * 3.14159 * $r;
}
use io;                            # a built-in library
import "./geo.j" as geo;           # a module of your own
import "@jennifer/telegram/";      # a deck, vendored by jvc
11 / 17

Concurrency with spawn

use io;
use task;

func sumTo(n as int) {
    def total as int init 0;
    for (def i in 0..$n) {
        $total = $total + $i;
    }
    return $total;
}
def a as task of int init spawn { return sumTo(1000); };
def b as task of int init spawn { return sumTo(2000); };
io.printf("%d\n", task.wait($a) + task.wait($b));
12 / 17

Tests are built in

use testing;
import "./geo.j" as geo;

func testCircumference() {
    testing.assertEqual(geo.circumference(1.0), 6.28318);
}
$ jennifer test geo_test.j
PASS testCircumference (0 ms)

1 passed, 0 failed, 1 total
13 / 17

The toolbox in the binary

CommandDoes
jennifer run, replrun a file, try a line
jennifer fmt -wformat the code the one canonical way
jennifer lintcatch what compiles but is suspect
jennifer testrun the test functions
jennifer profiletime and allocations per line
jennifer tokens, astshow what the parser sees
14 / 17

Packages with jvc

jvc add "@jennifer/telegram" "^0.1.0"   # a requirement in deck.toml
jvc install                             # vendor what camcorder.lock pins
jvc update                              # move to the newest allowed

Decks live at registry.jennifer-lang.dev.

15 / 17

The traps, once more

ElsewhereIn Jennifer
x = 5def x as int init 5; then $x = 6;
x += 1, i++$x = $x + 1;
&&, ||, !and, or, not
// comment# comment (// is floor division)
s[0]$s[0..1]
my_varmyVar (MY_CONST for constants)
16 / 17

Where to go next

Based on Jennifer 0.26.0, November 2026.

17 / 17