Every time there is news about a language, the first thing I am interested in is reading the syntax, I don't really care about anything else. Unfortunately it's often hard to find code examples. Zig doesn't fail that rule, I browsed 3 or 4 pages or so on the website, and could not find decent code examples. It's frustrating. You should be proud of the syntax choices you're making and it should be the first thing you…
Zig: programming language designed for robustness optimality and clarity [video]
41–50 of 73 posts
Re: Zig: programming language designed for robustness optimality and clarity [video]
#42Earlier quoted context omitted.
Ok, got it. Apparently, espeed was using an unusual definition of "memory safety", which made their comment a bit odd :)
What was unusual about that? Here is Wikipedia: "Memory safety is the state of being protected from various software bugs and security vulnerabilities when dealing with memory access, such as buffer overflows and dangling pointers.[1] For example, Java is said to be memory-safe because its runtime error detection checks array bounds and pointer dereferences." This is the mainstream definition. Do you think Zig doesn'…
Re: Zig: programming language designed for robustness optimality and clarity [video]
#43Features I want are: * pythonic indent * no trailing semicolon * vector, hashmap and map containers * immutable strings
Re: Zig: programming language designed for robustness optimality and clarity [video]
#44Earlier quoted context omitted.
I may be wrong, but if I read the documentation correctly, Rust looks more memory-safe than Zig. What am I missing?
Rust has lifetimes and ownership as language concepts so that you have to be explicit about who owns a resource, for example memory, but it does not give you a lot of control about what to do when an allocation fails. Zig is designed so that you can still peogrammatically deal with a failing allocation, as does well-written C, but it does not have a ownership system like Rust.
Re: Zig: programming language designed for robustness optimality and clarity [video]
#45Personal taste, not factual One-True-Way™ It looks on the surface like almost Rust meets JS with a sprinkling of Ruby/Smalltalk. Semicolons in 2018, really? Indentation and line-oriented parsing makes code more beautiful. Heck, in general, enums, arrays and dictionary literals shouldn’t even need commas if there’s one tuple per line. Extra typing is a waste of time and clutters-up code with distracting, Christmas orn…
Re: Zig: programming language designed for robustness optimality and clarity [video]
#46Re: Zig: programming language designed for robustness optimality and clarity [video]
#47Where are the generative capabilities? It seems there is no macro-like thing in Zig, though there are comptime parameters (and I guess: monomorphized templates).
Re: Zig: programming language designed for robustness optimality and clarity [video]
#48I have read quickly through the tutorial, and this looks interesting. Objectives are similar to Rust, with a few twists. A few differences that I can see: - At first glance, Rust's `enum` looks safer and more powerful than Zig's `union` + `enum`, while Zig's `union` + `enum` appears more interoperable with C. - Zig's `comptime` is quite intriguing. In particular, types are (compile-time) values and can be introspecte…
Re: Zig: programming language designed for robustness optimality and clarity [video]
#49Earlier quoted context omitted.
Do nullable types and maybe types add much over checked dereferences (a la Java)? I imagine they might be good for performance (fewer checks), but does it really help with correctness/convenience/elegance/readability/etc?
In my experience from Rust & co, yep, this improves correctness a lot. Elegance, not so much.
Re: Zig: programming language designed for robustness optimality and clarity [video]
#50Earlier quoted context omitted.
There was a HN discussion ~4 months ago that touched on some of this: "Unsafe Zig Is Safer Than Unsafe Rust" https://news.ycombinator.com/item?id=16226235 Also see this previous thread on Rust's stdlib OutOfMemory errors: "Containers should provide some way to not panic on failed allocations" https://github.com/rust-lang/rust/issues/29802
> "Unsafe Zig Is Safer Than Unsafe Rust" Yes, I've seen that blog post. Definitely a useful analysis, but it doesn't strike me as a fundamental difference, i.e. adding this check (as a warning) to rustc doesn't look too hard and wouldn't break existing code. Also, as pointed out in the title, that's code explicitly marked as `unsafe` in Rust, so it might not be an entirely fair comparison :) > "Containers should prov…