Skip to content

Commit

Permalink
meta: Added some dicumentation related to karm.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Dec 23, 2024
1 parent 877a296 commit 63e0c3f
Show file tree
Hide file tree
Showing 3 changed files with 3,196 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/libs/doc/karmism.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Karm'ism

Everything here is built on top of Karm, a modern C++ framework that makes the language safer and easier. This document will guide you in using the library to its fullest potential 💪😤

## Choosing a reference type

We avoid using raw pointers at all costs. The following decision tree should help you find a suitable alternative for your use case.

![Choosing a reference type](./references.png)

**Legend**

- `T&` - [Basic C++ reference type](https://en.cppreference.com/w/cpp/language/reference). Provides a way to refer to an existing object without taking ownership.
- `Slice<T>` - Represents a view over a contiguous sequence of elements (e.g., arrays or vectors). It does not own the elements but allows safe, bounds-checked access.
- `Cursor<T>` - A pointer-like structure for iterating through elements with additional context or state information (e.g., current position in a stream).
- `T` - The base type. Ownership and reference semantics are determined by the context in which it is used (e.g., passed by value or reference).
- `Box<T>` - An owning smart pointer type that manages heap-allocated objects. Ensures single ownership and automatic deallocation when no longer needed.
- `Strong<T>` - A type that enforces ownership semantics and resource safety, often used for unique, non-copyable resources. Provides strong exception safety guarantees.
- `T*` - Raw pointer. Gateway to hell, don't use it unless you have a ***really*** good reason. (Hint: you don't)
Binary file added src/libs/doc/references.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 63e0c3f

Please sign in to comment.