Files
fz-lang/docs/en/philosophy.md
T

1.7 KiB

Language philosophy

FZLang has two guiding goals: “be convenient as a tool, while always trying to remain predictable.”

Here are some of the ways the language tries to follow that philosophy.

Memory and resources

In environments with a garbage collector (GC), programmers don't know exactly when the collector will run. An object may remain in memory for seconds after a method has finished. And when cleanup does happen, the runtime may pause briefly—something that can matter in audio, games, networking, or embedded systems.

FZLang uses scope-based RAII, a model in which memory use is deterministic. Every object belongs to a scope, and when that scope is destroyed, the object is destroyed with it. This makes response times more consistent and predictable.

Scope-based RAII also helps manage resources such as sockets and files. Resource cleanup follows the same clear rule: when a scope ends, everything attached to it is cleaned up.

Finally, scope-based RAII avoids the runtime overhead of a full garbage collector. A GC needs mechanisms such as memory maps, background threads, and read and write barriers. FZLang's virtual machine is small, and memory is released as instructions are processed.

Syntax

FZLang deliberately keeps some parts of its syntax explicit. For example, methods of a class instance must use this, and declarations require types. These are strict parts of the language.

On the other hand, a function declaration can omit a return type when it doesn't return a value; writing void every time would be unnecessary.

In this way, FZLang aims to balance syntax that keeps behavior predictable with simplifications that are genuinely useful.