Asserts

Aperta
#1,716 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
c, erlang

Direzione di ricerca

Start by reading term.h and how TERM_DEBUG_ASSERT is used, then look for existing assert or assume macros in the codebase. The issue raises questions about cold and hot paths, runtime overhead, release behavior, and benchmarking, but gives no chosen behavior or success criteria; clarify those decisions before implementation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Currently, there's not a lot of asserts in the project, except for term.h.
term.h uses TERM_DEBUG_ASSERT to implement asserts. It's currently not defined, I suspect when changing code there, people define it temporarily.

Some thoughts:

  1. I really like using assets in cold paths like NIFs, they don't have much overhead and can save some debugging and adds a bit of clarity for invariants.
  2. For hot paths, having a toggleable assert macro would be also nice. It also needs benchmarking, maybe asserts in term.h doesn't slow execution that much.
  3. I heard that there are plans for adding ASSUME macro. I don't know any specifics, in other languages this typically refers to checking invariants that should stay in release builds.

I'm wondering if contributors have desire for having more asserts in the codebase.

Lingua principale
Erlang
Stelle
2.3k
Fork
171
Merge medio
5g 11h
PR unite (30g)
19

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di atomvm/AtomVM

Tutte le issue di atomvm/AtomVM

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.