Blorp by Example
A concise path through the language, from small runnable programs to systems features.
How To Read This Guide
Each page sticks to a short set of subheads and one focused example. The early pages favor code you can run with blorp run or blorp test.
func main(args: List[String]) -> Void:
print("Hello, world!") -- prints: Hello, world!
Foundations
- InstallationInstall the dev release, verify it, and know when to build from source.
- Hello, Blorp
main, printing, running a file, and exit codes. - Blorp CLICheck, run, test, format, compile, and inspect Blorp programs.
- Values and NamesInferred bindings, annotations, immutable names, and
varrebinding. - Expressions EverywhereLast-expression returns,
ifvalues, statement conditionals, and loops. - FunctionsParameters, return types, helpers, recursion, and
@tail_recursive. - Method SyntaxMethod-style calls, chains, imports, and field access precedence.
- Pure Functions
pure func, local mutation, effect boundaries, and pure callbacks.
Core Data
- Strings and TextInterpolation, chars, raw strings, pipe strings, and common methods.
- Integers
Int, sized conversions, wrapping defaults, bounds, and checked helpers. - Floats
Float, sized floats, formatting, math helpers, and approximate comparisons. - Fixed Point
Fixeddecimal values, scale, precision, rounding, and conversions. - ListsReading, building, safe access, chained transforms, and parallel preview.
- Option
Some,None, no null,match,get_or,map, andand_then. - Result
Ok,Err, predictable failure, and explicit handling. - ?=Success binding and short-circuiting for
OptionandResult. - Records and StructsNamed fields, record update, and struct value types.
- Unions and EnumsVariants, payloads, enums, and explicit states.
- Pattern MatchingVariants, literals, tuples, list patterns, wildcard, and exhaustiveness.
- Dictionaries
Dict[K, V], lookup asOption, insertion order, counting, and grouping. - Sets
Set[T], uniqueness, membership, set algebra, and list conversion.
Program Structure
- Imports and ModulesPrelude, selective imports, qualified imports, modules, and visibility.
- GenericsType parameters, inferred type params, containers, and reusable helpers.
- TraitsStandard traits, bounds, operator traits, and implementing traits.
- Testing
TestSuite, assertions, running tests, and organizing examples. - DoctestsDocstrings, named doctests, and examples as API contracts.
Safety and Runtime Model
- Memory by ExampleValue semantics,
ARC/COW, aliases, and closure capture. - Debugging and Diagnostics
check, formatting,debug:, and compiler errors. - Concurrency
concurrent:, task results, timeouts, and cancellation points. - Channels and Pipelines
Channel[T],send/recv,seal, and channel iteration. - Parallel Collection WorkPure callbacks,
List.parallel(), and collecting results.
Numerics and Systems
- Numbers and Safe ArithmeticWrapping defaults, divide-by-zero behavior, and checked helpers.
- Vectors, Matrices, and Tensors
Float[#3], compile-time bounds, dot product, and matrix basics. - Dimension Safety
#N, dimension-preserving functions,where, andassert_shape. - Performance Tools
--profile, benchmark hygiene, instrumentation, and generated C. - FFI Preview
foreign func, C ABI, purity/safety modes, and package boundaries. - Where to Go NextStd tour, examples, tests, architecture docs, and contribution paths.
Working Programs
- Input and CLI Arguments
args,input, EOF asNone, stderr, and exit codes. - Files and Paths
open_read,open_write, scoped file handles, andResulthandling. - Processes and EnvironmentEnvironment variables, process helpers, and shell safety.
- JSON, CSV, and Codec ValuesParse, inspect, validate, and encode.
- Building a Small CLI App
argparse, pure core, impure shell, and tests. - Elm-Style TUIPure Elm-style
init,update, andview, with input/output isolated in the shell.