Language reference
On this page
Use these pages to explore language features and common patterns. Start with the course for a guided introduction, or browse the function reference for built-in functions.
| Page | Covers |
|---|---|
| Operators | Arithmetic, comparison, bitwise, castAs, instanceOf, elvis and safe navigation |
| Destructuring, spread and ranges | { a, b } = s, ..., 1..5 |
| Sets | set{}, setNew, algebra operators, member functions |
| Classes | init, inheritance, interfaces and properties |
| Scopes | variables, arguments, closures, web scopes |
| Error handling | try, typed catch, finally, throw and rethrow |
| Async and futures | runAsync, then, errors, browser behavior |
| Templates (.bxm) | Markup, expressions and script blocks |
| Modules | --module, ModuleConfig.bx, discovery |
| Java interop | The JNI bridge and its limits |
| Queries and data | queryNew, datasources, query of queries, build features |
File types
| Extension | Use |
|---|---|
.bxs | Script. Run with matchbox file.bxs. |
.bx | Class file, resolved by new and import. Also accepted as a module BIF file. |
.bxm | Template. Run with matchbox file.bxm or serve with --serve. |
.bxb | Compiled bytecode, produced by matchbox --build. |
.cfm, .cfc and .cfs files are not supported. matchbox page.cfm fails with a parse error.
For an overview of runtime and target differences, see BoxLang compatibility.