Live data from Hacker News

Zig 0.4.0 Released

ziglang.org

91–100 of 141 posts

Re: Zig 0.4.0 Released

#91
post #71

Earlier quoted context omitted.

On platforms written in C. As for the negativity, Morris worm is now 30 years old and the CVE database gets C derived exploits every month.

You can interface with Object Pascal (which you frequently advertise) just fine. (That doesn't make Object Pascal a practical language, though). https://www.quora.com/Why-is-the-JVM-so-riddled-with-securit... Another fact is, startup times alone make JVM impractical for many endeavours. For each task an appropriate tool I'll say.

That Quora post is really only relevant when using Java applets. If you're running a local program, you're faced with similar vulnerabilities as with any other language with a managed runtime. Still doesn't make it relevant as a competitor to C or C++.

Re: Zig 0.4.0 Released

#92
post #24

Earlier quoted context omitted.

I don't see any single thing replacing C (or C++) but what's interesting here is many of these languages work very well with the C ABI, not just as an FFI concept but with notions of memory and data layout. The interesting side effect might be that we'll see Zig not just work with C code but Zig work with Jai with D with Rust. All of that code can still interface with C or C++ code (in both directions). This lowers t…

> The interesting side effect might be that we'll see Zig not just work with C code but Zig work with Jai with D with Rust. All of that code can still interface with C or C++ code (in both directions) That already works, not a hypothetical. I can write, right now, a zig function, call it from rust, slap the whole thing into a library and wrap it with d. It hasn't taken the world by storm because these languages provi…

COM is not windows specific any more! Or rather there is a portable COM-like thing which looks like a good fit for cross language development https://github.com/Microsoft/xlang

It's from the team who delivered cppwinrt (aka moderncpp). So the C++ projection doesn't have all the nasty baggage one usually associates with COM. https://msdn.microsoft.com/en-us/magazine/mt745094.aspx?f=25...

Re: Zig 0.4.0 Released

#93
post #89

Earlier quoted context omitted.

You can interface with Object Pascal (which you frequently advertise) just fine. (That doesn't make Object Pascal a practical language, though). https://www.quora.com/Why-is-the-JVM-so-riddled-with-securit... Another fact is, startup times alone make JVM impractical for many endeavours. For each task an appropriate tool I'll say.

JVM startup times are only an issue for those that don't want to buy a commercial JDK with AOT compiler support. Good news, now OpenJDK and GraalVM offer it for free, gratis. Object Pascal/Delphi is quite pratical on Windows.

> Object Pascal/Delphi

It has a sane subset which is basically C with a slightly saner syntax than C (the begin...end and lacking data initialization syntax are terrible though!), and with a proper module system and much better compile times.

On the other hand, it was crippled by missing a usable preprocessor and an ecosystem that has bought into each hype since the 90's, resulting in 23 incompatible kinds of strings, 101 different dynamic arrays, and about 5 (really) incompatible object models with different kinds of memory management. Programmers with many years in the language don't really understand all the ways memory is managed in this language.

Now try writing something on top of the broken RTTI for that. Even official guides basically concede the fact by writing quirky code that easily breaks.

Also you have to declare typealiases for every little thing like pointer-to-types, before you can use that type in a function signature. This alone renders it almost completely unusable for my purposes.

It has a culture of goto-considered-harmful where people like to indent 13 times instead of using return/continue/break, which would yield readable control flow. If you want to return something, you need to write two lines - assigning to the result and calling exit(). You can't call exit() though when the current class has a method called exit(), since that method is closer in scope (REALLY REALLY WEIRD).

I know what I'm talking about. I've been paid to work in it, and refactored a subsystem written in idiomatic Delphi to be halfway maintainable, achieving real speedups of 100-1000x by following a straightforward "data-oriented" approach, just like I would write it in C, writing complicated code only where the straightforward approach was not feasible in the language. Despite completing the project successfully (there hasn't been a single problem since the rewrite), in the end I was burnt out due to having to work with the original code. Didn't work for 5 months afterwards.

Re: Zig 0.4.0 Released

#94
post #90

Earlier quoted context omitted.

Interesting choices. They're all very old. I feel we must have learned something since the 1970s that could be used to improve a systems programming language. I don't really want to restart a flame war that was extinguished decades ago but Kernighan's critique of Pascal ( http://www.lysator.liu.se/c/bwk-on-pascal.html ) is an interesting read today - if only because it reminds me how much simpler things were back the…

Kernighan's critique was very biased and he focused on plain ISO Pascal on purpose to get his point across. Cleverly not mentioning that many issues were fixed on ISO Extended Pascal and other dialects. Also that back then outside Bell Labs, most C compilers were actually dialects of the real thing, like Small C and RatC. So it was not like C wasn't without its portability issues outside UNIX. As for memory safety an…

> Cleverly not mentioning that many issues were fixed on ISO Extended Pascal and other dialects.

Yes, Kernighan was “clever” in 1981 to ignore ISO Extended Pascal, a standard published in 1991. (I'm also not sure if there was ever more than one implementation of Extended Pascal, though Free Pascal claims it as a planned future feature.)

Re: Zig 0.4.0 Released

#95
post #64

Earlier quoted context omitted.

Have you got an example of a C replacement that was actually better than C, got as far as Zig and is now abandoned? I can't think of one. I've been look for a better C for 15 years and Zig is the best candidate I've found. I don't think DasbetterC counts, since it is a side effort to the greater goals of D.

Turbo Pascal, Object Pascal and Modula-2 would be such examples. Their sin was not being bundled with an OS, originally distributed with source code by a symbolic price.

> Turbo Pascal

Was not abandoned, it was rebranded to “Delphi” and is still around.

Re: Zig 0.4.0 Released

#96

Earlier quoted context omitted.

i don't want to sound harsh but in 2010s, the way you released (I assume you're V author) mostly make people dubious

Well I haven't released anything yet :) Can you elaborate?

Mainly because it seems like you constantly lie and make promises you can't keep. Some of your claims are outrageous without any evidence.

Of course I would like to be proven wrong.

Re: Zig 0.4.0 Released

#97

Hm, a one-liner turnoff: const std = @import("std"); * pointless semicolon * pointless "@" * seemingly pointless "const" (can you define a mutable import?) * unnecessary verbosity defining an identifier for the import when there's almost never a need for naming it differently (i.e. it should default to "const std" if you just type "import 'std'"... I like Go because it avoids pointless verbosity most of the time.

> I like Go because it avoids pointless verbosity most of the time.

Except for all those times you had to manually write err != nil

Re: Zig 0.4.0 Released

#98
post #36

"Zig is aggressively pursuing its goal of overthrowing C as the de facto language for system programming." If there's one truth I've learned in my decades of dealing with computers, it's that you can't beat C at being C. Before now, I'd never heard of Zig in particular, but I can think of several other languages that have tried or are currently trying. A lot of people seem to think they can make something a little be…

A couple of things have changed though. LLVM exists, we are being flooded by parser frameworks that make that whole business much more pleasant than the lex/yacc days, the llvm and Regehr blogs both spelled out some info on undefined behavior that previously people either didn't understand or refused to believe, the size of software engineering has grown to include many different niches, computer architectures have by and large grown more homogeneous (and where they're different you aren't going to be exploiting their power with lowest common denominator C), memory hierarchies aren't flat and it's becoming the determining factor in program speed, etc.

It's not obvious what needs to come next, which is the only reason that C is still here. Most likely several languages are needed to fully replace it. And our industry is starting to feel that out now.

D, Go, Rust, Jai, Zig, P, C# low level primitives. Things are changing. Even C++ seems to want to be a different language with some of it's latest developments.

Re: Zig 0.4.0 Released

#99
post #34

Earlier quoted context omitted.

Honestly, I don't see it happening. Zig and rust and jai and d all feast on c's remains, but the result can only be fragmentation. And then you lose one of the big draws of c: ubiquity. Zig has two compilers. Rust has one (serious) compiler. Jai has 1, d has either 1.5 or 3.5 (depending on how you count). And although all those languages want to replace c as the language-that-you-use-for-everything, and they might ea…

Maybe I'm a bit of a rust fanboy and a bit of a skeptic but Zig and Jai aren't going anywhere. Zig appears to be a largely single contibutor ( https://github.com/ziglang/zig/graphs/contributors the creator has As for rust we don't know yet how big of a chunk of marketshare it will take from new c and c++ code. Not many people still use c code for "everything", most have already switched.

> Zig appears to be a largely single contibutor

Aside from starting Zig as his personal project, Zig is also Andrew's job now. As far as I'm aware that is not true of any other contributor, so it makes sense he'd have the lion's share of contributions.

Re: Zig 0.4.0 Released

#100
post #11

[Off-topic] Another programming language website with no code examples front/center on the homepage? When you click "Download & Documentation" there's a link under the headline "master" to the long-form documentation which has some examples: https://ziglang.org/documentation/master/ Edit: also found a blog post with a nice introduction: https://andrewkelley.me/post/intro-to-zig.html and an examples directory: https:/…

My favorite website for an example of this functionality is: https://dlang.org/.

Succinct examples on a clean page, no fluff.

Post reply on HN