I thought that was time zones? (https://news.ycombinator.com/item?id=17181046)
Zig: programming language designed for robustness optimality and clarity [video]
11–20 of 73 posts
Re: Zig: programming language designed for robustness optimality and clarity [video]
#12From the slides, these bullets struck me as things I have wanted for a while (to the extent that I have my own toy language that addresses some of them): - compiles faster than C - Produces faster machine code than C - Seamless interaction with C libs - robust/ergonomic error handling - Compile-time code execution and reflection - No hidden control flow - No hidden memory allocations - Ships with build system - Out-o…
That means no destructors, right?
edit Ah, if I read the documentation correctly, there are destructors.
Re: Zig: programming language designed for robustness optimality and clarity [video]
#13From the slides, these bullets struck me as things I have wanted for a while (to the extent that I have my own toy language that addresses some of them): - compiles faster than C - Produces faster machine code than C - Seamless interaction with C libs - robust/ergonomic error handling - Compile-time code execution and reflection - No hidden control flow - No hidden memory allocations - Ships with build system - Out-o…
> - No hidden control flow That means no destructors, right? edit Ah, if I read the documentation correctly, there are destructors.
Re: Zig: programming language designed for robustness optimality and clarity [video]
#14From the slides, these bullets struck me as things I have wanted for a while (to the extent that I have my own toy language that addresses some of them): - compiles faster than C - Produces faster machine code than C - Seamless interaction with C libs - robust/ergonomic error handling - Compile-time code execution and reflection - No hidden control flow - No hidden memory allocations - Ships with build system - Out-o…
> - No hidden control flow That means no destructors, right? edit Ah, if I read the documentation correctly, there are destructors.
Re: Zig: programming language designed for robustness optimality and clarity [video]
#15It 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 ornament “blink tags” that go “Ho, ho, ho” when anyone walks by.
# package name is the same as the directory path
# module name is the same as the filename sans extension
# big modules can be broken up into separate include files
con X: int = 6 # constant
var M: int = 17 # module-public variable
mix any # module-private mixin
λ any? -> bool
each {x| if (Block? ? yield(x) : x): return true}
false
ext []: mix any # module-private type extension
typ T: int[10][8]
λ Zero? -> bool: any? {x| x.any? {y| y == 0}}
typ S
a, b: int
x, y: float
s[7..6], t[5], u[4..2], _[1], v[0]: byte
λ Good? -> bool: xGood? & yGood? # no & / && distinction, precedence by expression type
λ xGood? -> bool: x > 0
λ yGood? -> bool: y > 0
uni Q # union
I: int
F: float
λ thisIsPrivate(x: int) -> int
x + M + 1
λ ThisIsPublic(x, y: float) -> float
π * (x + y - X)Re: Zig: programming language designed for robustness optimality and clarity [video]
#16I've been building a toy project in zig in the last couple weeks. Zig is incredible. After only a short while working with it, it feels like deserves the title of a "better C". With no runtime overhead you get: * Type inference - var name = "Bob"; * Maybe types (from Elm/Haskell) that prevent NULL ptr bugs and syntactic sugar encourages its use for function return values. if (doit()) |result| { // result is always a…
I imagine they might be good for performance (fewer checks), but does it really help with correctness/convenience/elegance/readability/etc?
Re: Zig: programming language designed for robustness optimality and clarity [video]
#17There are too many cool languages and too few weekends. It's becoming more problematic, but at the same time it would seem impractical to optimize my life around learning every single thing that I want to learn. How do I decide which things are important enough? I am running out of time in my life also. I watched a video a while ago about how the universe is expanding faster than light can travel, which means the por…
> I wonder if zig will ever pursue some sort of memory safety. That's exactly what Zig is designed for [1]. Andrew Kelley (andrewrk) discusses this in the talk. Zig is similar to Rust, but with memory safety designed into the core, not bolted on as an afterthought. And as the SHA-256 demo tests in the talk show, Zig is as fast or faster than C. [1] http://ziglang.org [2] https://github.com/ziglang/zig
Do you know at what timestamp (roughly) this is mentioned in the video? YouTube makes it hard to quickly skip around in the video to find this. Or, better, a link to a written source? I'd be interested in what exactly is being compared. It's easy to cheat on benchmarks, especially when you aren't doing it on purpose.
Re: Zig: programming language designed for robustness optimality and clarity [video]
#18A 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 introspected.
- Zig's generics are very different from Rust's generics. No idea how to compare them.
- In particular, Zig's `printf` uses `comptime`, while Rust's `print!` is a macro.
- Zig's Nullable types/Result types look bolted in and much weaker than Rust's userland implementation.
- I don't see closures in Zig.
- I don't see traits in Zig.
- I don't see smart pointers in Zig, and more generally, I have no idea how to deallocate memory in Zig.
- Zig's memory management encourages you to check whether your allocations have succeeded, while Rust's out-of-the-box memory management assumes that allocations always succeed - if you wish to handle OOM, you'll need a "let it fail" approach.
- Zig's alias checker seems to be much more lenient than Rust's.
- I don't see anything on concurrency in Zig's documentation.
- Most of the Zig examples I see seem to fall in the "unsafe" domain of Rust by default. For instance, uninitialized memory or pointer casts seem to be ok in Zig (if explicitly mentioned), while they must be labelled as `unsafe` to be used in Rust.
- According to https://andrewkelley.me/post/unsafe-zig-safer-than-unsafe-ru..., Zig performs some checks that Rust does not perform in an `unsafe` block.
- Zig supports varargs, Rust doesn't (yet).
For the moment, I'll keep coding in Rust, but I'll keep an eye on Zig :)
Re: Zig: programming language designed for robustness optimality and clarity [video]
#19I've been building a toy project in zig in the last couple weeks. Zig is incredible. After only a short while working with it, it feels like deserves the title of a "better C". With no runtime overhead you get: * Type inference - var name = "Bob"; * Maybe types (from Elm/Haskell) that prevent NULL ptr bugs and syntactic sugar encourages its use for function return values. if (doit()) |result| { // result is always a…
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?
Re: Zig: programming language designed for robustness optimality and clarity [video]
#20There are too many cool languages and too few weekends. It's becoming more problematic, but at the same time it would seem impractical to optimize my life around learning every single thing that I want to learn. How do I decide which things are important enough? I am running out of time in my life also. I watched a video a while ago about how the universe is expanding faster than light can travel, which means the por…
> I wonder if zig will ever pursue some sort of memory safety. That's exactly what Zig is designed for [1]. Andrew Kelley (andrewrk) discusses this in the talk. Zig is similar to Rust, but with memory safety designed into the core, not bolted on as an afterthought. And as the SHA-256 demo tests in the talk show, Zig is as fast or faster than C. [1] http://ziglang.org [2] https://github.com/ziglang/zig
What am I missing?