3 ms·
Zig Zen Update
- rowbin 5mo agoI'm out of the loop. Is there any context? Can't pick up on what really changed here.
- dgellow 5mo agoThe link shows the exact diff
- rowbin 5mo agoI saw what changed syntactically. I meant I don't really understand what changed semantically. And whether there is any context to why the change was necessary.
- dgellow 5mo agoThe commit message feels clear to me? It seems Andrew wanted to clean the zig zen slightly, it’s not a big change: > - rewordings > - "memory is a resource" goes without saying > - emphasize the final point
- frde_me 5mo agoI'm guessing the parent is wondering why this is noteworthy enough to be posted and discussed in this thread, and so if there's context they are missing
- Validark 5mo agoGlad to see "Together we serve the users" come back. I miss the old Zig readme that said Zig comes with an MIT license and a humble request to build software that serves the users.
- mcherm 5mo agoNicely done! I always felt that Python's "There should be one-- and preferably only one --obvious way to do it." was a bit of a mess. Obviously (to anyone who was around at the time), that plank was written in response to Perl's motto: "There is more than one way to do it." Zig's original take on this, "Only one obvious way to do things" seems even worse. You see, both languages agree that Perl had it wrong: it is unhelpful to have several different ways to write any future. But they went a little too far: it is not actually bad for it to be possible to write the same thing in more than one way. Zig's new phrasing: "There is an idiomatic way to do it." captures the CORRECT alternative to Perl's motto. It is not important that there be no alternative ways of writing something, Rather, it is important that there be a single idiomatic way to write it.
- Fraterkes 5mo agoI think people criticize that line in the zen of Python because Python has now become very maximalist. On it's own merits, I think "There should be one obvious way to do it" is much better, less clunky, than "There is an idiomatic way to do it". Also, importantly, the Zen of Python is kinda written as a set of ideas that Python should aspire to ("there should be one obvious way to do it") instead of a sales pitch of Python's merits. I prefer that.
- iroddis 5mo agoIt all sounds great until someone writes nested list comprehensions. They are the recommended, idiomatic way to things most sane people would use ‘map’, ‘filter’, and ‘reduce’ chains, although chains are another thing python very much dislikes.
- brakl 5mo agoThis is a losing proposition. Because just like in Python, it may also generate endless debates on "ok, but what exactly is the idiomatic way for this particular thing here"? Is it A, or B, or maybe C? Since many are always possible, each optimizing for slightly different things, like simplicity, or maintainability, or performance, or readability, or coverage, etc. Groups may form furiously asserting that the idiomatic way must be C, others defending B, or A, and for what. Why does it matter? A young language free from cruft, after a long history of various decisions that led it on certain paths, can boldly claim such nonsense, but makes one wonder how it may look in 30 or 40 years, when other languages/ecosystems will point at its mistakes. Arguably Perl had it right all along, it's just a simple fact of life, expressed in such a generic manner that there is no need to fight it, since it's obviously true. Python's retort at the time was just clever marketing (aka lies), that worked (fooled a lot of people), it targeted Perl specifically just because that was the main competition back then.
- melon_tusk 5mo agoI don't see how Zig will ever contend with Odin, Jai, C3 and others when they drive away half of the prospective users with activism.
- dom96 5mo agoWhat activism is that?
- kristoff_it 5mo agotrying to make good software :^)
- quarkz14 5mo agotruly a tragedy! how dare you make good software!?!
- sgt 5mo agoI've never seen any activism from the Zig crowd (I assume you need Woke and rubbing "pride" or "Ukraine" into everything). Did I miss something?
- midnight_eclair 5mo ago> I assume you need Woke and rubbing "pride" or "Ukraine" into everything wow, what a self report
- IshKebab 5mo agoI think they banned AI and moved from GitHub to Codeberg. They don't seem too controversial to me, and IMO they've already comprehensively trounced Odin, Jai and C3.
- logicchains 5mo ago[flagged]
- alberth 5mo agoOT: any word on how Codeberg has been working out for Zig?
- peesem 5mo agothe maintainers seem happy, especially now that CI is actually working how it's supposed to. but a non-rare complaint in the Zig discord is how slow Codeberg can be, and other things like the lack of codesearch hurt as well.
- Panzerschrek 5mo ago> Resource allocation may fail Yes it can. But it's nearly impossible to handle such cases properly. That's why checking each allocation manually is a bad idea. Other languages do this better - they provide nice abstractions, but if something fails, the language runtime terminates the process. The result is the same, but has much less friction. Also on some systems (like Linux) memory allocation may not fail, but the "allocated" memory may not be available and a program can crash accessing this memory.
- lionkor 5mo agoZig is in the space of languages where an abstraction that decides that memory allocations are irrecoverable is not good enough. If you work in an environment where memory allocations can't fail or can't be handled if they fail, you might not want to use Zig, or C for that matter. Not every language should be designed to live in the space of "somehow low level but also a good choice for your basic web backend", like Rust.
- Panzerschrek 5mo ago> If you work in an environment where memory allocations can't fail or can't be handled if they fail, you might not want to use Zig, It's most of environments. Basically any program running under a modern OS. So, why do this language exists, if its practical applicability is so small?
- lionkor 5mo agoOn modern OSs you can write Zig and just ignore allocation errors. It doesn't force you to handle them properly. This language exists to supercede or supplement C, not JavaScript or C#. It's practical applicability is similar to that of C, so I struggle to comprehend how it is "so small".
- Panzerschrek 5mo ago> On modern OSs you can write Zig and just ignore allocation errors. I can ignore errors, but I still need to free memory manually if I want to avoid memory leaks. Languages like C++ or Rust have destructors, which do the job for me. > This language exists to supercede or supplement C There are way better alternatives, like Rust. Even C++ is better.