← Back to Docs

🧬 Core Concepts

Atoms, Molecules, Quarks — the building blocks of The Guardian

The Three Pillars

🔷 Quarks

Primitive values — int, float, bool, string, char.

Quarks live on the stack. They are fast, automatic, and memory-safe.

Quark q1(42);        // integer
Quark q2(3.14);      // float
Quark q3(true);      // bool
Quark q4("Hello");   // string

🧱 Atoms

Heap-allocated data — arrays, dictionaries, custom types.

Atoms live on the heap. They are tracked by the LUT for safety.

auto arr = std::make_shared();
arr->push(42);
arr->push(3.14);

🧬 Molecules

Containers that hold quarks and atoms.

Molecules are the "objects" of The Guardian — nested, flexible, safe.

Molecule mol;
mol.add_string("name", "Guardian");
mol.add_number("version", 1.0);
mol.add_bool("active", true);

Memory Safety

The Guardian uses LUT (Lookup Table) to track every pointer allocation:

memory::MemoryManager mem;
void* ptr = mem.allocate(1024);
mem.register_pointer(ptr, 1024, "buffer");
// ... use ptr ...
mem.unregister_pointer(ptr);
mem.deallocate(ptr);

✅ No dangling pointers
✅ No use-after-free
✅ No double-free
✅ No GC overhead

Safe by Design, Not by Choice

The Guardian is built so that safety is automatic, not optional.