Comment by benreesman

Comment by benreesman a day ago

36 replies

It's just a different convention like radians and degrees.

You can lift/unlift in or out of arbitrary IO, in some languages one direction is called a mock, in other languages the opposite is called unsafeFoo.

Andrew Kelley independently rediscovered on a live stream 30 years of the best minds in Haskell writing papers.

So the future is Zig. He got there first.

pjmlp a day ago

Only if use after free story actually gets fixed, and not by repurposing what has already existed in the C and C++ ecosystems for the last 30 years, like PurifyPlus or VC++ debug allocator.

  • benreesman a day ago

    If you mean running clang-tidy as a separate build step or ASAN in a different category than other soundness checks?

    Compute is getting tight, lots of trends, the age of C++ is winding down gracefully. The age of Zig is emerging delibetately, and the stuff in the middle will end up in the same historical trash bin as everything else in the Altman Era: the misfortunes of losing sight of the technology.

    • pjmlp a day ago

      I mean those and other ones, we already have enough unsafe languages as it is.

      The age of C++ is going great, despite all its warts and unsafety, thanks to compiler frameworks like GCC and LLVM, games industry, GPGPU and Khronos APIs.

      Even if C++ loses everywhere else, it has enough industry mindshare to keep being relevant.

      Same applies to C, in the context of UNIX clones, POSIX, Khronos, embedded.

      Being like Modula-2 or Object Pascal in safety, in C like syntax, isn't enough.

      • pron a day ago

        > we already have enough unsafe languages as it is

        By that logic, we definitely have enough safe languages as it is, as there are many more. But this safe/unsafe dichotomy is silly, and is coloured by languages that are unsafe in some particular ways.

        1. Memory safety is important because memory-safety violations are a common cause of dangerous security vulnerabilities. But once you remove out-of-bounds access, as Zig does, memory safety doesn't even make it to the top 5: https://cwe.mitre.org/top25/archive/2024/2024_cwe_top25.html I.e. the same logic that says we should focus on safety would lead us to conclude we should focus on something else.

        2. Memory safety has a cost. To get it, you have to give up something else (there could even be a cost to correctness). That means that you have to consider what you're getting and what you're losing in the context of the domain you're targeting, which is not the same for all languages. C++, with its "zero-cost abstractions", believed it could be everything for everyone. That turned out not to be the case at all, and Zig is a very different language, with different goals, than C++ originally had.

        Given Zig's safety guarantees (which are stronger than C++'s), and given its goals (which are different from C++'s), the question should be what should we be willing to give up to gain safety from use-after-free given the language's goals. Would more safety be better if it cost nothing? Of course, but that's not an option. Even Java and Rust could prevent many more dangerous bugs - including those that are higher risk than use-after-free - if they had more facilities like those of ATS or Idris. But they don't because their designers think that the gains wouldn't be worth the cost.

        If you don't say what Zig programmers should give up to gain more safety, saying "all new languages should be memory-safe" is about as meaningful as saying we should write fewer bugs. That's a nice sentiment, but how and at what cost?

      • benreesman a day ago

        Haskell makes guarantees. Modern C++ makes predictions to within a quantifiable epsilon.

        Rust makes false promises in practical situations. It invented a notion of safety that is neither well posed, nor particularly useful, nor compatible with ergonomic and efficient computing.

        It's speciality is marketing and we already know the bounding box on its impact or relevance. "Vibe coding" will be a more colorful and better remembered mile marker of this lousy decade in computers than Rust, which will be an obscurity in an appendix in 100 years.

    • wolvesechoes a day ago

      > The age of Zig is emerging delibetately

      Pet projects are nice, but slow down with the copium intake.

[removed] a day ago
[deleted]
kllrnohj a day ago

> So the future is Zig. He got there first.

The future is many things, but a love letter to C is definitely not it.

Zig is cute and a fun hobby project that might see above average success for a hobby project. But that's about it. It doesn't address the problems people actually have with C++, not like Rust or Swift do, and it certainly isn't going to attract any attention from the Java, JavaScript, C#, Python, etc... of the world.

  • davemp 13 hours ago

    Zig is not a hobby project.

    > It doesn't address the problems people actually have with C++, not like Rust or Swift do

    Speak for yourself. Zig addresses pretty much all of my problems with C++:

    - terrible compile times - overly complex and still underpowered template/meta programming - fragmented/ancient build tools - actually good enums/tagged unions - exceptions - outdated OOP baggage

    I don’t actually mind C++ that much, but Zig checks pretty much all of my boxes. Rust/swift check some of these but not all and add a few of their own.

    > and it certainly isn't going to attract any attention from the Java, JavaScript, C#, Python, etc... of the world.

    Yeah of course. Zig isn’t trying to be a max ergonomics scripting language…