Getting Started

Maggie is a modern language in the Smalltalk family, built on a Go runtime. It combines Smalltalk's elegant message-passing syntax with Go-style concurrency, a module system, and a distributed runtime for code exchange.

If you know Go, JavaScript, or Python, Maggie will feel different at first -- everything is an object, and all computation happens by sending messages to objects. This guide walks you through the language from first expression to distributed deployment.

Test
3 + 4 >>> 7
'hello' , ' world' >>> 'hello world'

Running Maggie

The mag command is the main entry point. Start an interactive REPL session with mag -i, or load and run source files directly.

Common invocations:

When a maggie.toml manifest exists in the current directory, mag automatically detects it and loads the project with its dependencies.

Expressions and Messages

Everything in Maggie is an expression that returns a value. There are no statements -- even assignments return the assigned value.

Computation works by sending messages to objects. There are three kinds of messages:

Test
'hello' size >>> 5
3 + 4 >>> 7
#(10 20 30) at: 0 >>> 10

Variables and Assignment

Use := to assign a value to a variable. Variables do not need to be declared before use. Inside methods, variables are local to the method scope.

Test
x := 42.
x >>> 42
x := x + 1.
x >>> 43

Literals

Maggie supports numbers, strings, symbols, characters, arrays, and the special values nil, true, and false.

Test
42 class name >>> #SmallInteger
3.14 class name >>> #Float
'hello' class name >>> #String
#hello class name >>> #Symbol
true class name >>> #True
nil isNil >>> true
#(1 2 3) size >>> 3

Comments

Single-line comments start with # at the beginning of a line or after whitespace. Traditional Smalltalk double-quote comments are also supported inside method bodies.

Docstrings (triple-quoted strings) attach documentation to classes, traits, and methods. They are not comments -- they are preserved in the compiled image and accessible at runtime.

What Next

The following chapters cover the language in depth: