Beyond Zig and Rust: A More Human-Friendly Approach to Metaprogramming
This article explores a novel programming language design that combines the strengths of Rust's Hindley-Milner type system and Zig's compile-time capabilities, while avoiding the complexities of Zig's 'types as values' approach. By introducing the `@` operator for compile-time execution, the `Abstract` type for compile-time abstractions, `TypeInfo` and `Field` types for type introspection, and `Code` and `parse` functions for code manipulation, this design achieves powerful metaprogramming capabilities such as automatic code generation and the implementation of TypeScript-like utility types like `Partial`, all while maintaining code readability and ease of reasoning. This represents a new approach to achieving powerful metaprogramming while preserving type system friendliness, offering fresh perspectives for future language design.