Earlier quoted context omitted.
AFAIK garbage collection is basically not implemented yet. I myself do `ZIG_LOCAL_CACHE_DIR=~/.cache/zig` so I only have to nuke single directory whenever I feel like it.
what exactly people call 'garbage collection' in Zig? build cache cleanup?
Type resolution redesign, with language changes to taste
71–80 of 284 posts
Re: Type resolution redesign, with language changes to taste
#72Earlier quoted context omitted.
I've worked on two "production" zig codebases: tigerbeetle [0] and sig [1]. These larger zig projects will stick to a tagged release (which doesn't change), and upgrade to newly tagged releases, usually a few days or months after they come out. The upgrade itself takes like a week, depending on the amount of changes to be done. These projects also tend to not use other zig dependencies. [0]: https://github.com/tigerb…
I really wanted to deep dive into zig but I'm into rust now kinda late as I'm really just started like 2024. Have you tried rust? how does it compared to zig? * just asking
- Zig: Let's have a simple language with as few footguns as possible and make good code easy to write. However we value explicitness and allow the developer to do anything they need to do. C interoperability is a primary feature that is always available. We have run time checks for as many areas of undetermined behaviour as we can.
- Rust: let's make the compiler the guardian of what is safe to do. Unless the developer hits the escape hatch, we will disallow behaviour to keep the developer safe. To allow the compiler to reason about safety we will have an intricate type system which will contain concepts like lifetimes and data mobility. This will get complex sometimes so we will have a macro system to hide that complexity.
Zig is a lot simpler than Rust, but I think it asks more of it's developer.
Re: Type resolution redesign, with language changes to taste
#73Earlier quoted context omitted.
Why isn't rustc using Cranelift then?
I can think a few reasons: - Cranelift applies less optimizations in exchange for faster compilation times, because it was developed to compile WASM (wasmtime), but turns out that is good enough for Rust debug builds. - Cranelift does not support the wide range of platforms (AFAIK just X86_64 and some ARM targets)
There is a whole ecosystem of contributions across the globe and the lingua franca used by those contributors.
Re: Type resolution redesign, with language changes to taste
#74Earlier quoted context omitted.
> But I prefer Rust over Zig. The main difference is Rust chooses a "closed world" model while Zig chooses an "open world" model: in Rust, you must explicitly implement a trait while in Zig as long as the shape fits, or the `.` on a structure member exists (for whichever type you pass in), it will work (I don't use Zig so pardon hand wavy description). Do you happen to have a more specific example by any chance? I’d…
They are referring to `anytype`, which is a comptime construct telling the compiler that the parameter can be of any type and as long as the code compiles with the given value, it's good. It's an extremely useful thing, but unconstrained, it's essentially duck typing during compile time. People has been wanting some kind of trait/interface support to constrain it, but it's unlikely to happen.
I quite like it when writing C++ code. Makes it dead easy to write code like `min` that works for any type in a generic way. It is, however, arguably the main culprit behind C++s terrible compiler-errors, because you'll have standard library functions which have like a stack of fifteen generic calls, and it fails really deeply on some obscure inner thing which has some kind of type requirement, and it's really hard to trace back what you actually did wrong.
In my (quite limited) experience, Zig largely avoids this by having a MUCH simpler type system than C++, and the standard library written by a sane person. Zig seems "best of both worlds" in this regard.
Re: Type resolution redesign, with language changes to taste
#75Re: Type resolution redesign, with language changes to taste
#76Earlier quoted context omitted.
I really wanted to deep dive into zig but I'm into rust now kinda late as I'm really just started like 2024. Have you tried rust? how does it compared to zig? * just asking
Zig is a modern C, Rust is a modern C++/OCaml So if you enjoy C++, Rust is for you. If you enjoy C and wish it was more verbose and more modern, try Zig.
I know, timelines not matching up, etc.
Re: Type resolution redesign, with language changes to taste
#77Re: Type resolution redesign, with language changes to taste
#78Earlier quoted context omitted.
Claude CLI is based on bun. The dependency is so complete that Bun have now joined Anthropic.
Claude CLI is not exactly a reference of usable software
Re: Type resolution redesign, with language changes to taste
#79Earlier quoted context omitted.
Zig is a modern C, Rust is a modern C++/OCaml So if you enjoy C++, Rust is for you. If you enjoy C and wish it was more verbose and more modern, try Zig.
Seriously asking, where Go sits in this categorization?