Misusing Const for Fn and Profit
summary
Claims that large amounts of runtime work can move to compile time by combining const functions with macros executing arbitrary code, shows present_term compiling examples live, and names crates that actually do it (SQLx for compile‑time SQL checks against a dev DB, const-random/const_time for compile‑time RNG, macrolisp for DSLs). Demonstrates what is supported and forbidden in const, notes crab time demo fails on the machine, and points out security concerns exist but are tractable and already addressed in tooling.
AI-written summary · about
chapters (8)
- 0:00Introduction and context
- 2:37Understanding const functions
- 6:45Capabilities of const context
- 9:00The power of macros
- 10:17Advanced macro applications
- 13:41Risks and safety concerns
- 15:35Security considerations
- 17:23State-of-the-art crates
related talks
52mHow to declare a constant in C++
39mRust metaprogramming - macro_rules! beyond basics
23mFunctional Programming in C++ (Run time vs Compile time types)
29mMacromancy: an introduction to Rust macros
01h 30mC++ in Constrained Environments
05mLightning Talk: Detecting Constant Folding to Prevent Substitution Failure
54mCompile-Time Validation in C++ Programming
19mCounterexamples in Safe Rust
