Pretty.c

Overview & Goals

  • Pretty.c is a header-only collection of C preprocessor macros that make C look like a higher-level, “scripting-like” language while remaining fully compatible with existing C compilers and libraries.
  • Stated goals include extreme syntactic sugar, “deprecating” popular scripting languages, and being “lightning-fast and strongly typed.” Many readers interpret this as partly tongue-in-cheek.

Macros, Compatibility, and Design

  • Works via #include "pretty.h"; no extra tooling beyond a C compiler. It’s “just aliases” expanded by the preprocessor, not a separate transpiler or VM.
  • Some praise the implementation as surprisingly clean and elegant for heavy macro use; others find the entire approach terrifying and unsuitable for shared or serious codebases.
  • Users highlight specific features they like (type aliases, len, max/min, boolean operators, loop DSL, resource tracking) and suggest using only a small subset.

Floating-Point Equality Controversy

  • The equal(0.3, 0.2 + 0.1) example triggers a long debate.
  • Current implementation uses absolute-difference < FLT_EPSILON / DBL_EPSILON. Multiple commenters argue this is incorrect except near 1.0 and equivalent to == for larger magnitudes.
  • Suggestions include scaling by ε * max(|x|, |y|) and handling infinities explicitly. Author acknowledges trade-offs between convenience and correctness.

Typing, “Strong Typing,” and Scripting Claims

  • Several push back on calling C “strongly typed,” showing trivial examples where silent narrowing conversions produce nonsense results.
  • Discussion clarifies that “strong vs weak” is a spectrum; many see C as statically but weakly typed.
  • Debate on what “scripting language” means: some insist it implies interpretation; others argue it’s about usage (glue/one-off tasks) rather than compilation.

Syntax Sugar & Readability

  • Mixed reactions to constructs like ifnt for if (!...), always/forever/loop for infinite loops, and “beginner-friendly” claims.
  • Some think it’s fun, educational, and reminiscent of Lisp’s LOOP or ALGOL/Pascal-style C macros; others fear macro “magic” harms maintainability and debugging.

Strings, Bytes, and Unicode

  • Brief debate over conflating “string” with char*.
  • Some argue languages should distinguish human-readable text from arbitrary bytes; others note C and several modern languages keep strings encoding-agnostic and rely on libraries.

Tooling, REPLs, and Alternatives

  • Suggestions include using tcc, Clang-REPL, or C interpreters/REPLs to make Pretty.c feel more “script-like.”
  • Related projects (other macro-heavy C DSLs, GC libs) are mentioned as inspirations or complements.