💾 Archived View for yujiri.xyz › software › my-ideal-lang.gmi captured on 2024-12-17 at 10:19:32. Gemini links have been rewritten to link to archived content
View Raw
More Information
⬅️ Previous capture (2024-08-18)
-=-=-=-=-=-=-
yujiri.xyz
Software
What I want in a programming language
last edited 2023-07-10
Broad strokes
Interpretation is a sin
- No garbage collection. While I find manual memory management kinda fun, I'm under no illusion that it's *practical* for most software, so I would like some kind of compile-time memory management system. I think what would make me the happiest is something like Rust's but doesn't enforce exclusivity of mutability. I think most of the times Rust's gets in the way are because of that, and few of the times it helps are because of that.
Type system
Essentials:
- Generics (Zig's system counts)
- Sum types or tagged unions
- Static arrays (as in Rust)
- A static polymorphism system like Rust's traits or Zig's anytype
Ideally also, in order of importance:
- A dynamic polymorphism system like Rust's trait objects
- Overloading operators (being able to implement things like +, - on 2D coordinates)
- Negative indexing (as in Python)
Errors
I want errors to work like a combination of Rust and Zig:
- I want the `orelse` and `catch` keywords (Zig)
- I want it to be easy to use different error types together (Zig)
- I want errors to be able to carry information (Rust)
- I want to reuse the concept of sum types instead of making optionals and error unions language-level features (Rust)
Syntax
- Expression-based; ordinary if/else syntax works as a ternary operator, etc
Tooling
- Documentation generator that allows command-line viewing like Go.
- Built-in formatter, or if not, a good third-party one that's popular enough to be considered the standard style of the language. I also want its style to be reasonable, unlike rustfmt. I want me to be in charge of deciding when to break a line.
Metaprogramming
I want something to overcome the limits of static typing. Not runtime reflection. My favorite solution so far is Zig's, which lets you get information about types with `@typeInfo` and manipulate them with ordinary code executed at compile-time.