From: <mcsinyx@disroot.org>
To: "Maxime Devos" <maximedevos@telenet.be>,
"Mája Tomášek" <maya.tomasek@disroot.org>,
guix-devel@gnu.org
Subject: Re: Strategy for Zig packages
Date: Wed, 03 Aug 2022 12:35:58 +0900 [thread overview]
Message-ID: <CLW2UXOX7XY2.1J8R0OJ0KMXNB@nix> (raw)
In-Reply-To: <c70b3c23-fd59-a7be-1f0f-36837477039a@telenet.be>
On Tue Aug 2, 2022 at 11:09 AM +0200, Maxime Devos wrote:
> On 02-08-2022 07:21, mcsinyx@disroot.org wrote:
> > On Mon Aug 1, 2022 at 10:43 PM +0200, Mája Tomášek wrote:
> > > More realistic (imo) is that zig should be encouraged
> > > to build dynamically linked packages, not static ones,
> > > and allow the ability (with their future package manager)
> > > for the distribution to distribute it's libraries C-style.
> >
> > Technically this is not always possible since Zig relies
> > on compile-time execution for generic.
>
> Rust has generics (and macros (*)) and its compiler does
> static compilation, so I don't see why it would be impossible
> for Zig to do static libraries.
>
> (*) Including macros that can run arbitrary Rust code, see
> <https://doc.rust-lang.org/book/ch19-06-macros.html#declarative-macros-with-macro_rules-for-general-metaprogramming>,
> so there you have compile-time execution too!
FWIW I was commenting on the impossibility
of dynamically linking Zig libraries that uses comptime.
On Tue Aug 2, 2022 at 11:09 AM +0200, Maxime Devos wrote:
> I don't think this is a problem, as Guile has macros (*) yet
> it supports compilation (and shared libraries -- .go files
> are ELF shared libraries) -- macros are, in a sense,
> merely procedures that transform syntax into syntax,
> which can be compiled, and generics could be considered
> a special case of macros.
>
> (Shared libraries might be harder, but you could just monomorphise
> generics in the 'user' of the shared library, so shared libraries
> appear technically possible to me as well.)
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.
That being said, there may be a Zig ABI in the future, with the cost
of missing certain features (like comptime) and optimizations:
https://github.com/ziglang/zig/issues/3786
On Tue Aug 2, 2022 at 11:11 AM +0200, Maxime Devos wrote:
> On 02-08-2022 07:21, mcsinyx@disroot.org wrote:
> > Zig source files could be handled in the same manner as C headers
> > however, and be used as native inputs, so downstream can still
> > update a library for all dependees at once.
>
> Going for native-inputs and not non-native sounds incorrect
> when cross-compiling. We might need to substitute* a "executable"
> -> "/gnu/store/.../bin/executable", and the latter file name
> is architecture-dependent. (This holds generally, including
> for C headers).
Thanks, coming from Nix I forgot that Guix does not make use of PATH.
next prev parent reply other threads:[~2022-08-03 3:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-26 10:56 Strategy for Zig packages mcsinyx
2022-07-26 18:48 ` Liliana Marie Prikler
2022-07-26 19:23 ` Maxime Devos
2022-08-01 20:43 ` Mája Tomášek
2022-08-02 5:21 ` mcsinyx
2022-08-02 9:09 ` Maxime Devos
2022-08-03 3:35 ` mcsinyx [this message]
2022-08-04 23:56 ` Maxime Devos
2022-08-02 9:11 ` Maxime Devos
2022-08-02 9:01 ` Maxime Devos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CLW2UXOX7XY2.1J8R0OJ0KMXNB@nix \
--to=mcsinyx@disroot.org \
--cc=guix-devel@gnu.org \
--cc=maximedevos@telenet.be \
--cc=maya.tomasek@disroot.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).