These are notes for a Zig-inspired strongly-typed GC language, taking some aspects from Python, and retaining some smiilar simplicity as promised by Go.
Zig brings so several great ideas to the table, but a variant of its apporoach for application-space would be very welcome, so it would provide a similar experience to Zig with many of its characteristics:
- error unions
- optionals
- defer
- block scopes
- structs
- struct methods with explicit
self
- strict typing
- mandatory discard-assignment
It adds on top of this:
- garbage collection
- native variable-length lists and mash maps
- private members on structs where name starts with underscore
_
- native strings and string-interpolation
- supporting at least basic native types:
- three primitives (int (
u32
), float (f64
), bool) - three composites (string (
[]u8
), list, map (map(string, any)
))
- Error payloads
assert
keyword on booleans and optionals (no "truthy" evaluation on other types)- simple enumerations (
enum { a, b, c}
, potentially assignment of primitives) - interface types
It would explicitly leave out comptime as the concept doesn't map, and specifially would choose to not implement:
- pointers - they could be made to map (Go does this) but I am wary of having this alongside a GC
- any attempt at object orientation - I'm not convinced this has really helped over the last few decades.
- closures - they make tracing back during debugging a nightmare, and falsely complexify systems. They're also more complicated to implement. Struct interface types with methods can help instead.
To be clear I'm not expecting to implement this any time soon, if at all.... these are just musings in a stub note...
See Zis_example.zig
(should be .zis
but changed the extension to use formatting