Zig 之禅 (Zen)

Zig 之禅是指导 Zig 语言设计和开发的核心原则。

  • 传达意图比简洁更重要。 (Communicate intent precisely.)
  • 边缘情况很重要。 (Edge cases matter.)
  • 读代码比写代码更重要。 (Favor reading code over writing code.)
  • 只有一种显而易见的方法来做某事。 (Only one obvious way to do things.)
  • 运行时崩溃优于未定义的行为。 (Runtime crashes are better than bugs.)
  • 编译错误优于运行时崩溃。 (Compile errors are better than runtime crashes.)
  • 增量改进。 (Incremental improvements.)
  • 避免局部最优。 (Avoid local maximums.)
  • 减少必须记住的内容。 (Reduce the amount one must remember.)
  • 专注于数据转换。 (Focus on data transformation.)
  • 内存分配是一种独特的失败模式。 (Memory allocation is a distinct failure mode.)
  • 消息是一个事件。 (A message is an event.)