Skip to content

Instantly share code, notes, and snippets.

@lambda-fairy
Created June 21, 2016 02:19
Show Gist options
  • Save lambda-fairy/68a7914662ccae1a22501afe8159d5d1 to your computer and use it in GitHub Desktop.
Save lambda-fairy/68a7914662ccae1a22501afe8159d5d1 to your computer and use it in GitHub Desktop.
Chara design ideas

Design goals

  • Perfect C compatibility

    • Every C type is a Chara type and vice versa
    • Use a similar compilation model
  • Stay simple: don't add super advanced features like C++ or Rust

  • Clean up C cruft

    • Undefined integer overflow
      • Make overflow behavior configurable, twos complement by default
    • The pre-processor sucks
      • Replace it with hygenic macros and attributes, like Rust
      • Procedural macros via IPC
    • Semicolons
      • Make semicolons unnecessary, like Go
    • Evaluation order is undefined
      • Top to bottom, left to right
    • Assignment operators can be chained
      • a = b is a statement
    • Prefix vs postfix increment is confusing
      • a++ is a statement; ++a is invalid syntax
    • Number promotion rules are confusing
      • Make all casts explicit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment