Live data from Hacker News

Zig got a new ELF linker and it's fast

github.com

31–40 of 51 posts

Re: Zig got a new ELF linker and it's fast

#31
post #23
post #20

Earlier quoted context omitted.

> I find the IO changes to be strange Perhaps you just feel that way because of 10+ years of accreted expectations? To me, it feels like a reinvention of an interesting idea: Fastbufs https://www.ucw.cz/libucw/doc/ucw/fastbuf.html I will concede that the ergonomics of Io in Zig right now are pretty rough sledding.

I said this elsewhere, but I think the awkwardness is coming from Zigs attitude towards interfaces. It seems like from a language design perspective they've been made intentionally awkward because they want to discourage their use, and fair enough. There are other options for sure. But now they want to base Io around interfaces. So Writers and Readers, it sounds like Async as well, and of course Allocators were alrea…

> It seems like from a language design perspective they've been made intentionally awkward

Awkward relative to what?

Relative to C? Did you look at my link to Fastbufs? Take a look at that and then get back to me how awkward Zig is relative to that.

Zig seems to be aiming to be a better C. Full stop. If you want abstraction, RAII and other higher-level stuff, C++ and Rust exist.

> If they are going to become that fundamental to core features of the language, I think a more ergonomic way to work them needs to be a higher priority.

I don't disagree. However, there have really only been two times so far that significant "interfaces" have churned like this (Allocgate and Writergate). Allocgate was driven by the fact that the previous implementation had real, measurable performance issues. Presumably, Writergate is being driven by similar problems. I'm actually really happy that someone is designing a language while paying very strict attention to the performance of both the compiler and the compiled code.

It's really hard to generalize until you get a couple of concrete examples under your belt. Trying to make an "interface" more ergonomic when it may get nuked from orbit in a couple of versions is kind of pointless.

I have plenty of gripes about Zig, but "interface churn" or "ergonomics" aren't very high on my list. I signed up for a language that is pre-1.0, so, while I may get annoyed, I also have to admit that I did this to myself.

Re: Zig got a new ELF linker and it's fast

#32
post #22

Earlier quoted context omitted.

I suspect a lot of this is due to the language being new and unpolished. Zig is still actively being shaped, and therefore fundamental pieces of the Zig standard library still change frequently. I really like Zig, but I do think you have to accept some rough edges and breaking changes when using it. Give it another decade and I am hopeful it will be much more stable.

I agree, and I try to ignore that stuff, but there are a few things that I think are a little more fundamental then that. This one is fairly minor, but the overly granular namespacing drives me nuts. I shouldn't have to go four or five layers deep to get fairly common functionality. The pattern of returning structs from within structs from within structs just gets old. Maybe that has to do with the way the language h…

Zig will be forced to introduce interfaces or traits or whatever they want to call it just like Go was forced dragged, kicking and screaming to introduce generics.

Nobody is going to want to live without proper interfaces or an equivalent in 202x instead of DIY hacks. Its a fundamental, building-block of software development. You will have a gazillion complaining in Zig forums after its 1.0 release.

Re: Zig got a new ELF linker and it's fast

#33
post #31
post #23

Earlier quoted context omitted.

I said this elsewhere, but I think the awkwardness is coming from Zigs attitude towards interfaces. It seems like from a language design perspective they've been made intentionally awkward because they want to discourage their use, and fair enough. There are other options for sure. But now they want to base Io around interfaces. So Writers and Readers, it sounds like Async as well, and of course Allocators were alrea…

> It seems like from a language design perspective they've been made intentionally awkward Awkward relative to what ? Relative to C? Did you look at my link to Fastbufs? Take a look at that and then get back to me how awkward Zig is relative to that. Zig seems to be aiming to be a better C. Full stop. If you want abstraction, RAII and other higher-level stuff, C++ and Rust exist. > If they are going to become that fu…

> Zig seems to be aiming to be a better C.

Modula-2 and Object Pascal already did that for me, before I cared with C on MS-DOS, unfortunely one did not come with UNIX as selling point, and the other had the two industry giants that cared doing the wrong decisions.

Re: Zig got a new ELF linker and it's fast

#34
post #18

I don't really have much interest in Zig the language, but Zig as a standalone C/C++ compiler is pretty great. I'm using it as a cross-compiler for linux-arm64 because its much simpler to download a single archive and extract it somewhere than to waste a bunch of time on guessing how each different Linux distro does ARM64 cross compilers (or doesn't in the case of Fedora).

Same for me.

The more Zig-the-language is hyped, the more I see it doesn't bring anything of interest. Zig-the-toolchain, on the other hand, is neat.

Re: Zig got a new ELF linker and it's fast

#35
post #32
post #22

Earlier quoted context omitted.

I agree, and I try to ignore that stuff, but there are a few things that I think are a little more fundamental then that. This one is fairly minor, but the overly granular namespacing drives me nuts. I shouldn't have to go four or five layers deep to get fairly common functionality. The pattern of returning structs from within structs from within structs just gets old. Maybe that has to do with the way the language h…

Zig will be forced to introduce interfaces or traits or whatever they want to call it just like Go was forced dragged, kicking and screaming to introduce generics. Nobody is going to want to live without proper interfaces or an equivalent in 202x instead of DIY hacks. Its a fundamental, building-block of software development. You will have a gazillion complaining in Zig forums after its 1.0 release.

The analogy with Go is quite interesting, because in the end, after Go got its generics, the actual usage of this feature is quite minimal compared to what I expected :)

Re: Zig got a new ELF linker and it's fast

#36
post #32

Earlier quoted context omitted.

Zig will be forced to introduce interfaces or traits or whatever they want to call it just like Go was forced dragged, kicking and screaming to introduce generics. Nobody is going to want to live without proper interfaces or an equivalent in 202x instead of DIY hacks. Its a fundamental, building-block of software development. You will have a gazillion complaining in Zig forums after its 1.0 release.

The analogy with Go is quite interesting, because in the end, after Go got its generics, the actual usage of this feature is quite minimal compared to what I expected :)

That's an interesting assertion but does not hold to reality. Nearly every single modern Go library leverages Generics in some manner AFAIK. It is a feature primarily meant for library authors anyways. Go generics are still limited - nowhere as powerful as Rust/C++ or even Java's generics. Primarily because they added it too late and ran into considerable trouble, instead of upfront thinking about the design.

Interfaces however are far more fundamental. Any app with components and modularization would declare intent through interfaces. Not having interfaces/traits as a language feature is like living without a hand or leg. Sure you can limp and hop, but it will get rather tiresome.

Re: Zig got a new ELF linker and it's fast

#37
post #18

I don't really have much interest in Zig the language, but Zig as a standalone C/C++ compiler is pretty great. I'm using it as a cross-compiler for linux-arm64 because its much simpler to download a single archive and extract it somewhere than to waste a bunch of time on guessing how each different Linux distro does ARM64 cross compilers (or doesn't in the case of Fedora).

I’ve been using it for an embedded project to target arm thumb and the typical x86-64 hosts that communicate with a protobuf based protocol. It’s absurdly convenient to be able to just give windows users the repo, zig binary, and tell them to run ‘zig build’.

Re: Zig got a new ELF linker and it's fast

#38
post #25

The more I hear about Zig, the more I appreciate it. Its vertically integrated stack (with the custom linker and code-generation backends) stands out to me as a really compelling feature that enables interesting optimizations. The compiler is also much easier to interact with in a consistent way compared to C. I've been using it as an experimental backend for my language project with great results.

> I've been using it as an experimental backend for my language project with great results. One annoyance that I've ran into when using Zig as a transpiler backend is the lack of unstructured goto. Many languages don't need that, but if you're dealing with the one that does, converting such code is non-trivial.

Labeled switches come pretty close. Is there a particular case you have in mind where they don't suffice?

Re: Zig got a new ELF linker and it's fast

#39

Just going to mention the book Linkers and Loaders by John R. Levine, I'm not sure if there's anything comparable to it.

Crafting Interpreters?

While also a great book, there is very little overlap in content to Linkers and Loaders.

Re: Zig got a new ELF linker and it's fast

#40
post #30

Earlier quoted context omitted.

Reader and writers were interfaces before 0.15.1. What’s new is that they are buffered. I don’t think that zig discourages interfaces, just that the language doesn’t hide anything. An interface in all system languages is a struct with a vtable just like in zig but that they have an easy way of creating one. If you need one in zig you can go that approach or use a tagged union just that zig is open about what an inter…

Yes I know. I see the same statement every single time this conversation comes. Let me ask this: hypothetically if they wanted to, would it be possible for Zig to add a language feature called Interface which provided to the user "...an easy way of creating one".

Creating an interface is fairly easy once you know how. I would say that it is as easy as in rust for a beginner. You get used to it and I don’t believe it needs a special keyword.
Post reply on HN