←back to thread

302 points Bogdanp | 6 comments | | HN request time: 0.434s | source | bottom
Show context
AndyKelley ◴[] No.44390865[source]
My homepage takes 73ms to rebuild: 17ms to recompile the static site generator, then 56ms to run it.

    andy@bark ~/d/andrewkelley.me (master)> zig build --watch -fincremental
    Build Summary: 3/3 steps succeeded
    install success
    └─ run exe compile success 57ms MaxRSS:3M
       └─ compile exe compile Debug native success 331ms
    Build Summary: 3/3 steps succeeded
    install success
    └─ run exe compile success 56ms MaxRSS:3M
       └─ compile exe compile Debug native success 17ms
    watching 75 directories, 1 processes
replies(8): >>44390894 #>>44390942 #>>44390948 #>>44391020 #>>44391060 #>>44391265 #>>44391881 #>>44393741 #
vlovich123 ◴[] No.44390948[source]
Zig isn’t memory safe though right?
replies(3): >>44391142 #>>44391516 #>>44391617 #
ummonk ◴[] No.44391516[source]
Zig is less memory safe than Rust, but more than C/C++. Neither Zig nor Rust is fundamentally memory safe.
replies(1): >>44391829 #
Ar-Curunir ◴[] No.44391829[source]
What? Zig is definitively not memory-safe, while safe Rust, is, by definition, memory-safe. Unsafe rust is not memory-safe, but you generally don't need to have a lot of it around.
replies(3): >>44392198 #>>44392909 #>>44395714 #
1. Graziano_M ◴[] No.44392909[source]
The second you have any `unsafe`, Rust is _by definition_ not memory-safe.
replies(2): >>44394967 #>>44395863 #
2. Ar-Curunir ◴[] No.44394967[source]
By that definition, Python is not memory-safe, Java is not memory-safe, Go is not memory-safe, and so on. All of these languages contain escape hatches to do memory-unsafe stuff, yet no one is calling them memory unsafe.
replies(1): >>44397357 #
3. Meneth ◴[] No.44395863[source]
And the majority of the Rust standard library uses `unsafe`.
replies(1): >>44396849 #
4. Measter ◴[] No.44396849[source]
Prove it. Show me the stats that the standard library is over 50% unsafe.
replies(1): >>44399381 #
5. ummonk ◴[] No.44397357[source]
Go is more memory unsafe than Java or Rust. Data races in concurrent Go code can cause memory corruption, unlike in concurrent Java code. Safe Rust is designed to avoid data races altogether using static analysis.
6. 9rx ◴[] No.44399381{3}[source]
"Over 50%" only holds if the statement is intended to be binary. It may be that he considers direct use, no use, and transitive use to be all different. In which case it is possible that the majority[1] use unsafe, even if more than 50% does not.

[1] The cult of the orange man would call this a plurality, which may be what has tripped you up, but the civilized world calls it a majority.