Bedrock Doc #1
Replies: 2 comments
Initial proposal doc for languageIntroduction
The goal is to provide the control expected from a systems language while removing unnecessary complexity from the programming model. The language intentionally avoids object-oriented programming. Programs are built using procedures, functions, structs, and modules instead of classes or inheritance. Design GoalsThe language is built around a few core principles.
Memory ModelThe language uses automatic memory management. Programmers never manually allocate or free ordinary language objects. There is no Manual MemoryManual memory management exists only for cases where programmer needs to interact with,
These are accessed through the FFI and require explicit management. Type SystemThe language uses static typing with compile-time type checking. Primitive types include: Composite types include:
VariablesVariables are declared using If you want a mutable Explicit types may also be written. Compile-time constants use Type DeclarationsAll user-defined types begin with the StructsEnumsUsing match expression on enums, Procedures and FunctionsThe language distinguishes between procedures and functions. A procedure performs work but does not return a value.
A function returns a value.
This distinction is intentional and improves readability while reflecting the language's procedural roots. Struct ConstructionStructs are constructed using function-like syntax. Control FlowConditional statements use explicit block endings. Loops follow the same style. Every block begins with a keyword and ends with MatchMatch expressions with tagged enums. Or with integers: Error HandlingOperations that may fail return an error type, making failure an explicit part of the function's signature. In the example above, Error PropagationThe language syntax provides a concise way to propagate errors.
Conceptually, the following code: is equivalent to: A function that can fail must explicitly indicate this in its return type. A function that cannot fail simply returns its value. By making failure explicit, the language encourages developers to acknowledge and handle error conditions rather than allowing them to be silently ignored. Optional ValuesSome operations may produce no value without it being considered an error. Such functions return an optional type. The return type Optional values make the absence of data explicit in the type system while avoiding the need for sentinel values or null pointer checks throughout the language. The
|
|
We will need a formal memory model and some blends of different kinds because there's a gap, the gap is data-oriented hot loops, thousands of short-lived objects allocated and dropped every frame gc heap suppose traces ~10,000 live objects, every frame |
Uh oh!
There was an error while loading. Please reload this page.
documentation of bedrock here.
All reactions