Live data from Hacker News

Zig: software should be perfect [video]

youtube.com

31–40 of 141 posts

Re: Zig: software should be perfect [video]

#32
post #5

Earlier quoted context omitted.

Yeah. Original title is “Zig: A programming language designed for robustness, optimality, and clarity – Andrew Kelley” and “Software should be perfect” is much more sensational.

If you look at the video, you'll see that "Software Should Be Perfect" is the title slide of the talk (you don't even have to click play, it's there at the start). And then the first words out of the speaker's mouth (other than a sound check) are "I'm going to try to convince all you that software should be perfect". The "original title" you're referring to is what the person who uploaded the talk to youtube titled t…

The "original title" is also what this video was posted as five months ago and discussed here: https://news.ycombinator.com/item?id=17184407

Re: Zig: software should be perfect [video]

#33
post #20

Re: performance claims, I wonder if the C sha256 implementation would have been more competitive with -march=native -mtune=native?

I think it would. I posted some observations on this the last time this video was discussed: https://news.ycombinator.com/item?id=17187140

My hypothesis is that Zig's compiler passes the equivalent of -march=native to the backend, which is why it should also be given to the C compiler to give a fair comparison (and a speedup of 30% or so).

Re: Zig: software should be perfect [video]

#34
post #30

Earlier quoted context omitted.

I made this argument in the talk: the only problem with exception-based handling is the lack of explicitness. It's too easy to call functions without being aware of the set of possible errors. Many c++ projects disable exceptions entirely. Writing "exception safe" code is tricky and non-obvious. Functions which should be guaranteed to never fail often can throw std::bad_alloc. Try-catch syntax forces incorrect nestin…

> the only problem with exception-based handling is the lack of explicitness - It's too easy to call functions without being aware of the set of possible errors. i.e. checked-exceptions?

yep! there was a sort of epiphany for me, the first I wrote Java, from Python, when I realized that I can be sure that my code could handle anything the callee could throw at it.

Re: Zig: software should be perfect [video]

#35
post #20

Re: performance claims, I wonder if the C sha256 implementation would have been more competitive with -march=native -mtune=native?

Why isn't `-march=native -mtune=native` enabled by-default for every piece of software compiled unless explicitly specified otherwise?

Re: Zig: software should be perfect [video]

#36
post #29

Earlier quoted context omitted.

> Related: Only zig has fast errors with traces. Other languages have no traces or a high performance cost. Look up error return traces in the docs. Out of curiosity, have you compared this to Rust’s backtrace mechanism? I’d be interested in the perf difference, if it’s available.

Rust's panics and their backtrackes are essentially the same as C++ exceptions.

I wasn’t actually thinking about panic, but the associated optional backtrace in Error types with Failure, for example: https://docs.rs/failure/0.1.3/failure/

Re: Zig: software should be perfect [video]

#37
post #21

It is actually a nice informative video, but the title is as dumb as dumbness itself. Software should not be perfect. It should be useful. In places where perfection increases usefulness (s.a autopilot), go ahead make it perfect. In most cases, striving for "perfection" is a profound misallocation of resources.

Upvoted since this is a useful comment and worth mentioning.

I'd expect some downvotes are based on negative reactions to this part of the comment: "the title is as dumb as dumbness itself." (Dear avip: if your comment said "the title is off-base" you would have made your point just as effectively and without the downvotes.)

Re: Zig: software should be perfect [video]

#38
post #9

Javascript (programming language) and Browser (runtime environment) is a perfect piece of combination. With JS, you have many choices of implementation. With Browser, runtime error doesn't crash user's device.

> With Browser, runtime error doesn't crash user's device.

There's a large number of JS bugs and sandbox escapes in all browsers. They certainly can crash the user device.

Re: Zig: software should be perfect [video]

#39
post #20

Re: performance claims, I wonder if the C sha256 implementation would have been more competitive with -march=native -mtune=native?

Why isn't `-march=native -mtune=native` enabled by-default for every piece of software compiled unless explicitly specified otherwise?

You'd have to ask the compiler communities that. As an observer, I notice that C compilers are extremely conservative about changing defaults in new versions. And I could imagine some benefits of that approach, and downsides. But I am not involved in e.g. gcc or clang development.

Re: Zig: software should be perfect [video]

#40
post #20

Re: performance claims, I wonder if the C sha256 implementation would have been more competitive with -march=native -mtune=native?

Why isn't `-march=native -mtune=native` enabled by-default for every piece of software compiled unless explicitly specified otherwise?

Compiling with -march=native makes for brittle binaries, since the binary might contain instructions that are not be available on slightly older CPUs or on virtual machines. So it's only suitable for software that's performance sensitive but won't be distributed to other machines (or at least won't be distributed outside of a strictly controlled environment). It wouldn't make for a good default.
Post reply on HN