Earlier quoted context omitted.
That's fair. I was born twenty years after Modula-2 was released, so I definitely have gaps in my language knowledge :D
Plenty of material over here, https://www.modula2.org/index.php As for the other ones I listed, https://en.wikipedia.org/wiki/Mesa_(programming_language) (some PDFs linked from there) https://bitsavers.org/pdf/borland/turbo_pascal https://www.freepascal.org https://docwiki.embarcadero.com/RADStudio/Sydney/en/Delphi_D... and https://learn.adacore.com/index.html http://www.ada-auth.org/arm.html
Why is Zig so cool?
511–520 of 527 posts
Re: Why is Zig so cool?
#512Earlier quoted context omitted.
It's not the same, defer does not conditionally interrupt the flow of execution, it will always run at the end of a block. If I see a defer, I am absolutely certain that whatever is deferred will run. The same is not true for exceptions. If I am not mistaken defer just moves the code at the end of the block, no jumping is involved.
> It's not the same, defer does not conditionally interrupt the flow of execution, it will always run at the end of a block. But destructors also don't conditionally interrupt the flow of execution, and always run at the end of a block. > If I see a defer The point is that you're not seeing it. In order to know if there's a defer happening at the end of a function you can't just read the end of the function, you need…
Why bring up destructors, I was talking about exceptions. Destructors and exceptions are orthogonal concepts, one can be implemented independently of the other. I'm specifically referring to try-catch blocks like those in java.
Compare this:
try { foo(); }
catch { bar(); }
to this: defer bar();
foo();
In the first one, bar() may or may not run depending if there's an exception. In the second one, bar is guaranteed to run. Thus, it means defer does not conditionally interrupt the flow of execution.> The point is that you're not seeing it. In order to know if there's a defer happening at the end of a function you can't just read the end of the function, you need to read the entire function.
What? You don't need to read the entire function, you only to scan or check for defers scoped in a block, or in some cases, just the top of a function or block. Wanting to just read the end of a function is unreliable anyway with the existence of early returns (which defer fixes by the way).
You could have made a more compelling (but not necessarily a valid) case by citing zig's try-catch, which makes me think that you are just arguing in abstract without actually having tried writing code that uses defer, or any zig code for that matter.
Re: Why is Zig so cool?
#513Earlier quoted context omitted.
The partial evaluation you mentioned.
I'm still not sure what exactly you're asking, but the implementation of print linked above ( https://ziglang.org/documentation/0.15.2/#Case-Study-print-i... ) typically requires some kind of syntactic macros in other lanugages as does something like "innerParse" here ( https://ziglang.org/documentation/0.11.0/std/src/std/json/st... ), this ( https://ziglang.org/documentation/0.15.2/#Generic-Data-Struc... ) would typ…
I mean a simple example. Just to illustrate the concept. Like the examples I provided here:
Re: Why is Zig so cool?
#514Earlier quoted context omitted.
> It's not the same, defer does not conditionally interrupt the flow of execution, it will always run at the end of a block. But destructors also don't conditionally interrupt the flow of execution, and always run at the end of a block. > If I see a defer The point is that you're not seeing it. In order to know if there's a defer happening at the end of a function you can't just read the end of the function, you need…
> But destructors also don't conditionally interrupt the flow of execution, and always run at the end of a block Why bring up destructors, I was talking about exceptions. Destructors and exceptions are orthogonal concepts, one can be implemented independently of the other. I'm specifically referring to try-catch blocks like those in java. Compare this: try { foo(); } catch { bar(); } to this: defer bar(); foo(); In t…
Re: Why is Zig so cool?
#515Earlier quoted context omitted.
I'm still not sure what exactly you're asking, but the implementation of print linked above ( https://ziglang.org/documentation/0.15.2/#Case-Study-print-i... ) typically requires some kind of syntactic macros in other lanugages as does something like "innerParse" here ( https://ziglang.org/documentation/0.11.0/std/src/std/json/st... ), this ( https://ziglang.org/documentation/0.15.2/#Generic-Data-Struc... ) would typ…
print is a fairly complicated case, as it has to deal with all kinds of different types. I mean a simple example. Just to illustrate the concept. Like the examples I provided here: https://news.ycombinator.com/item?id=45859669
Re: Why is Zig so cool?
#516Earlier quoted context omitted.
This is the real answer (amongst other goodness) - this one is well executed and differentiated Every language at scale needs a preprocessor (look at the “use server” and “use gpu” silliness happening in TS) - why is it not the the same as the language you use?
Languages such as D and Nim (both greatly underappreciated) offer full-language compile-time interpretation.
Re: Why is Zig so cool?
#517Earlier quoted context omitted.
Please, stop deadnaming the Raku Programming Language :-)
I thought it was useful information for people who did not know this. Of course Wikipedia would have sufficed, too: "Raku, formerly known as Perl 6 [...]".
If Wikipedia has deadnamed Raku with grace then that might be a model to follow, but in general it's far from helpful unless it's done carefully. There's a reason why the community embarked on the somewhat painful multi decade process of renaming it. To try clarify my understanding I'll summarize it here.
Because of the original name for Raku, people assumed for a long time (long after it became problematically misleading) that it shared semantics, or syntax, or compiler tech, or libraries, or something technical like that, with some other programming language(s).
This was partly because Raku did indeed take some inspiration philosophically and/or technically from some existing languages (traces of a half dozen or so are evident), and partly because Raku and its compiler tech features the ability to use Python code and compilers, and C code and compilers, and Perl code and compilers, and so on, as if they were native Raku code/compilers.
But Raku was never C, or Python, or Perl, and the old name is unfortunately a form of deadnaming -- which is to say, something that is seldom helpful, especially if some commentary like this comment is not included.
At least, that's how I experience it.
That said, regardless of my view, I love your impulse of being helpful, which is why I've written this -- and I hope it does help any readers.
Re: Why is Zig so cool?
#518Earlier quoted context omitted.
Sure, but Zig is bringing those to users and making headlines on HN. I think that’s generally a good thing. Bringing the best of prior languages together in a new package
Except in 2025 we know better regarding safer systems programming languages, use after free is no longer something that we should tolerate.
Re: Why is Zig so cool?
#519Earlier quoted context omitted.
I mostly write C, but yes even a simple call to e.g. malloc has different semantics in C++ (you need to cast).
Proper C++ should use new , delete , custom allocators, and standard collection types. Even better, all heap allocations should be done via ownership types. Calling into malloc () is writing C in C++, and should only be used for backwards compatibility with existing C code. Additionally there is no requirement on the C++ standard that new and delete call into malloc() / free() , that is usually done as a matter of co…
Re: Why is Zig so cool?
#520I'm afraid this article kinda fails at at its job. It starts out with a very bold claim ("Zig is not only a new programming language, but it’s a totally new way to write programs"), but ends up listing a bunch of features that are not unique to Zig or even introduced by Zig: type inference (Invented in the late 60s, first practically implemented in the 80s), anonymous structs (C#, Go, Typescript, many ML-style langua…
As a c++ developer who's heard of Zig but never dived into it, I was reading this article scratching my head wondering what is it actually so unique about it. Why the blog has a section on how it install it on the path is also very puzzling.