Introduction to Ferret
Ferret is a systems language with explicit ownership, predictable control flow, and practical tooling.
Ownership Model
Section titled “Ownership Model”Ferret makes ownership visible in the type:
Tplain value*Towning pointer&Tshared borrow&mut Tmutable borrow^T/^const Traw pointer forms (unsafe)
Core Language Features
Section titled “Core Language Features”- structs, enums, unions, interfaces
- optionals (
?T) and error unions (E!T) - attached methods (
fn Type::Method(...)) - arrays (
[N]T), slices ([]T,[]mut T), tuples ((A, B, C)) - module imports with
import "pkg/path"
Tooling
Section titled “Tooling”ferret checkfor type-checkingferret runto build and executeferret testfor unit test functions- built-in package manager
ferret get
Quick Example
Section titled “Quick Example”type Mode enum { debug, release,}
fn Label(mode: Mode) -> str { if mode == Mode::release { return "release" } return "debug"}
fn main() { let mode = Mode::debug println("mode:") println(Label(mode))}