Not in BT
Features BT deliberately leaves out, and what to write instead.
Types
| Absent | Write instead |
|---|---|
| User-defined generic types and functions | The built-in parameterized types (array<T>, map<K, V>, ...); interfaces; function values. |
Type inference (var, let, auto) | Name the type: int n = 0;. |
Unsigned integers other than byte | int or int32, which are signed. |
| Tuples and multiple return values | Return an object. |
Nullable scalars and strings (int?, string?) | A sentinel value, a separate bool, or a wrapper object. |
| Flow-sensitive null narrowing | Compare with null, then use the value; T? stays T?. |
| Type aliases | — |
Declarations
| Absent | Write instead |
|---|---|
| Constructors and destructors | A factory function returning an object literal; explicit close methods. |
Inheritance, abstract classes, implements | Interfaces (structural) and composition. |
| Static members | Top-level functions, constants and variables. |
| Method overloading and function overloading | Distinct names. |
| Default, optional and variadic parameters | Named arguments with explicit values; an array parameter. |
| Operator overloading | Methods. |
| Nested or local functions | Top-level functions. |
Access modifiers other than ~ | ~ (package-private declaration or field); everything else is public to files that include the package. |
Attributes, annotations, decorators (@) | — |
| Preprocessor and macros | — |
Expressions and operators
| Absent | Write instead |
|---|---|
| Lambdas, closures, anonymous functions | Top-level functions as values; pass context as parameters or object fields. |
Bound method values (obj.method as a value) | A top-level function taking the receiver. |
Ternary c ? a : b | A switch expression, or if/else assigning a local. |
Bitwise and shift operators (&, |, ^, <<, >>, unary ~) | Arithmetic (*, /, %). |
Prefix ++x; ++/-- as expressions | x++; as a statement. |
printf-style formatting (width, padding, precision) | Interpolation ("hp ${hp}") and float_to_string(x, decimals). |
Indexing or slicing strings with [] | string methods (byte_at, slice, chars). |
| Hexadecimal, octal, binary literals; digit separators | Decimal literals. |
| Map literals typed by their destination | A map literal takes its types from its first entry; write entries of the right type, or use new and assignment. |
Empty [] and {} literals | new array<T>(), new map<K, V>(). |
Reflection beyond typeof(T) (field enumeration, type names, dynamic invocation) | — |
Statements and control flow
| Absent | Write instead |
|---|---|
do ... while | for { ...; if (!cond) { break; } }. |
Labeled break/continue, goto | Flags, or move the inner loop into a function and return. |
try / catch / finally | !! { } handlers and && { } deferred blocks. |
Throwing non-error values | throw new error(code, message);. |
Empty statement ; | { }. |
Collections
| Absent | Write instead |
|---|---|
| Map deletion | Store a nullable value or a tombstone flag. |
Iterating channels or buffers with for ... in | receive() loops; index loops over a buffer. |
Concurrency
| Absent | Write instead |
|---|---|
async / await keywords | Every call may wait; branch and join make concurrency explicit. |
select send arms | A helper task that does the send. |
| Threads, atomics and condition variables | Tasks, channels and Mutex. |
| Thread-local storage | Pass state explicitly. |
Runtime
| Absent | Note |
|---|---|
| Manual memory management, pointers | Memory is freed automatically. |
| Finalizers | Explicit close; && { } cleanup. |
| Changing a running program in place | The host recompiles and restarts the program. |
| Catching traps | Traps end the task; validate before dividing or indexing. |