[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strategy for Zig packages

From: Maxime Devos
Subject: Re: Strategy for Zig packages
Date: Fri, 5 Aug 2022 01:56:15 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

FWIW I was commenting on the impossibility
of dynamically linking Zig libraries that uses comptime.
It doesn't make a difference, AFAICT my explanation on why it can work holds equally for static as for shared libraries.

On 03-08-2022 05:35, wrote:
Compile-time execution must be done at, well, compilation time,
thus macros in shared objects are just glorified embedded
source code that are not used at runtime.

My point was that macros and dynamic (or static) linking is compatible with generics and macros. Of course, if your Zig code consists purely of generics and macros, it's kind of pointless, but presumably there's non-generic code too and non-generic library code that chooses a particular instance of a generic (monomorphisation?) that could benefit from compiling only once instead of being recompiled for every leaf (+- application).

That being said, there may be a Zig ABI in the future, with the cost
of missing certain features (like comptime) and optimizations:

A fixed, stable, ABI or documented ABI is not required for Guix because we have the store and RPATH (or RUNPATH, I always forget which one we use) and the store model instead of putting things in /usr/lib and searching for them there, so occasional ABI breaks are not a problem for Guix.

Distros like, say, Debian, are another matter of course, though they could resort to build-from-scratch like done with Rust currently.

You are referring to optimisations, but at least LTO is perfectly combinable with static libraries (see, e.g., Rust). Shared libraries should be equally possible if it is accepted that it won't be always possible anymore to simply replace the shared library with another (because of things like inlining).


Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]