Skip to content
Plumlang

Language reference · Section 15

Changes from the Python prototype

The Python prototype (plum-lang v0.1 to v0.10) introduced the garden keywords; Plumlang keeps them and changes the rest where the prototype was hard to read or unsafe:

Prototype Plumlang Why
plant int x = 5 plant x = 5, plant x: int = 5 Inference; the type follows the name everywhere
branch int add(int a, int b) branch add(a: int, b: int) -> int The same name: type order as variables
drop x and drop(x) drop(x) only One way; drop is an ordinary function
&& || ! and or not Reads as English, and frees !
++ -- x += 1 One way to add one; no prefix/postfix puzzles
C-style for (init; cond; step) for i in 0..n, while Fewer ways to write a loop, no off-by-one setup
if (cond) if cond Parentheses optional, like any expression
Every number a float (25.0) int and float are separate drop(25) prints 25
10 / 2 gives 5.0 / gives a float, // an int Kept, and made explicit
Mixed #, //, -- comments # only One comment syntax
Type errors while running Type errors before running Caught early, with a location
Python exceptions leak out Plumlang errors with a stack trace Messages about your program, not the interpreter