ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
LewisGaul has quit [Ping timeout: 240 seconds]
earnestly has quit [Ping timeout: 268 seconds]
brzg has joined #zig
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
brzg has quit [Quit: leaving]
teratorn has quit [Ping timeout: 252 seconds]
xackus_ has joined #zig
xackus has quit [Ping timeout: 240 seconds]
teratorn has joined #zig
osa1 has quit [Ping timeout: 240 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
shodan45 has joined #zig
dom96 has quit [*.net *.split]
xentec has quit [Ping timeout: 252 seconds]
xentec has joined #zig
ur5us has quit [Ping timeout: 258 seconds]
cole-h has quit [Ping timeout: 252 seconds]
RadekCh has joined #zig
Anzh has quit [Ping timeout: 260 seconds]
earnestly has joined #zig
lemur has joined #zig
retropikzel has quit [Ping timeout: 252 seconds]
ur5us has joined #zig
kshlm has quit [Quit: Idle for 30+ days]
retropikzel has joined #zig
jokoon has joined #zig
l1x has quit [Quit: Connection closed for inactivity]
tnorth has joined #zig
pretty_dumm_guy has joined #zig
RadekCh has quit [Quit: Connection closed]
jokoon has quit [Quit: Leaving]
l1x has joined #zig
paulgrmn_ has joined #zig
ur5us has quit [Ping timeout: 258 seconds]
paulgrmn_ has quit [Ping timeout: 252 seconds]
Anzh has joined #zig
Anzh has quit [Ping timeout: 240 seconds]
Anzh has joined #zig
Anzh has quit [Ping timeout: 240 seconds]
retropikzel has quit [Ping timeout: 250 seconds]
waleee-cl has joined #zig
xackus__ has joined #zig
xackus_ has quit [Read error: Connection reset by peer]
teratorn_ has joined #zig
xackus__ has quit [Ping timeout: 252 seconds]
fireglow has quit [Quit: Gnothi seauton; Veritas vos liberabit]
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
teratorn has quit [Ping timeout: 240 seconds]
paulgrmn_ has joined #zig
<noam> I know there's been a bunch of comptime proposals. With all the accepted proposals, is it possible for a comptime function to have implicit inputs (e.g. to reference global comptime values or some such)?
<noam> IIUC, the desire to remove visible execution order means the answer is "no"?
fireglow has joined #zig
Anzh has joined #zig
<ifreund> woah, I was not aware of this: https://github.com/dundalek/liz
Anzh has quit [Read error: Connection reset by peer]
Anzh has joined #zig
Anzh has quit [Client Quit]
pretty_dumm_guy has joined #zig
RadekCh has joined #zig
<noam> I think I've seen that
nycex- has quit [Ping timeout: 240 seconds]
amk has quit [Ping timeout: 252 seconds]
amk has joined #zig
<noam> I *think* this makes sense: http://pixelhero.dev/c3/analysis (redesigned analysis pipeline for zyg)
xackus has joined #zig
nycex has joined #zig
LewisGaul has joined #zig
bndbsh has joined #zig
<fengb> TheLemonMan: I don't have a working *Linux* ppc box. Been running code on my Wii so I can test out freestanding
<mikdusan> TheLmeonMan: if you are still checking #8421, I have to get some sleep. will check status later.
teratorn_ is now known as teratorn
dyeplexer has joined #zig
aeldemery has joined #zig
marler8997 has joined #zig
<marler8997> I've got an issue with compiling a Gameboy Advance rom that I'm not sure how to solve, maybe someone has ideas
<marler8997> I've created a new library based on the existing ZigGBA one, which uses a custom linker script
<marler8997> the startup code is identified by a link section, and is located in a zig module in the gba library, problem is, how do you force zig to import a library?
<marler8997> the std library does the same thing, it has comptime { _ = start } in std.zig, which forces start.zig to get imported
<marler8997> however, what forced "std.zig" to get imported in the first place?
<marler8997> I'm hoping there is some configuration in build.zig that will allow me to force a module to get imported, so it works just like std.zig
<ifreund> marler8997: pretty sure that std.zig import is hardcoded in the compiler
<marler8997> yeah could be
<marler8997> ah
<marler8997> but wait
<marler8997> that just adds it to the package table, it doesn't force it to be "evaluated" as far as I know
<marler8997> compile_var_package looks interesting, maybe it has to do with that?
<marler8997> it looks like std.zig get imported/evaluated even if you don't explicitly @import it
aeldemery has quit [Ping timeout: 260 seconds]
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
<marler8997> maybe we could add a new field to std.build.Pkg like "force_eval"?
<ifreund> can't you just put `comptime { _ = @import("foo.zig"); } in your root source file?
<ifreund> I don't understand what your use-case is
<marler8997> yes that works
<marler8997> if they don't put it, it compiles fine and you just get an invalid rom image
xackus has quit [Ping timeout: 240 seconds]
xackus has joined #zig
plumm has joined #zig
RadekCh has quit [Quit: Connection closed]
<andrewrk> marler8997, the zig compiler effectively hard codes `_ = @import("std")`
<marler8997> andrewrk, yeah I kinda surmised that
<andrewrk> that pulls in start.zig, and start.zig pulls in your root source file
<marler8997> well, comptime { _ = @import("std"); } right?
<marler8997> const _ = @import("std"); wouldn't do anything
<marler8997> ah, thanks for the reference
<marler8997> I'm almost done creating an issue to describe this problem and a potential solution
cole-h has joined #zig
Akuli has joined #zig
jokoon has joined #zig
xackus has quit [Ping timeout: 252 seconds]
<andrewrk> marler8997, seems like start.zig should unconditionally do `_ = root;` do you see any reason why this is insufficient?
<andrewrk> wait, that's already the case, since it checks @hasDecl on root
<andrewrk> let me try to understand the problem statement more
<marler8997> yeah, we never get far enough to import start.zig
<ifreund> I think the problem is that someone using this GBA build setup might forget to add the `comptime { _ = @import("foo.zig"); }` to their root source file
<marler8997> I mean, import gba/start.zig
<ifreund> which I'm not 100% convinced really needs solving
<marler8997> do you have a way that forgetting it could cause a good error message?
<ifreund> marler8997: you said forgetting it produces an invalid rom. Can you trivially check if the produced binary is invalid?
<ifreund> if so, add a build.zig step to do just that
<marler8997> sounds possible
<marler8997> that could get kinda hairy for a library that runs on multiple platforms
<andrewrk> I think this is related to the idea/use case of having a package be an OS abstraction
<marler8997> yeah it seems related
<marler8997> we could create another special package name for this
<marler8997> for example, we could reserve the "start" package, and allow the user to set it
<marler8997> or, we could add a command-line option to provide a "start.zig" module?
xackus has joined #zig
LewisGaul has quit [Ping timeout: 240 seconds]
<andrewrk> I'm open to all of these possibilities
<noam> Hmm. I think start as a package is a better option
<marler8997> I'm trying to think if there are use cases where you'd want this behavior on things besides the program entry point
<andrewrk> noam, top level comptime blocks can reference any other decls. however, note that all comptime mutable state becomes immutable when the variable goes out of scope
* noam nods slowly
<noam> but comptime *functions* cannot, right?
<marler8997> if one were to write say a dynamic library in Zig, and you had exports split amongst multiple files, you use comptime { _ = @import("funcs1.zig); _ = @import("funcs2.zig"); } ??
<marler8997> *would you use
<andrewrk> noam, "comptime function" is a bit of a misnomer. there is only functions that execute at comptime, which causes local variables to become comptime mutable state. so, when these variables go out of scope, the comptime data (if references still exist) becomes immutable, and managed by the compiler's static data garbage collector (same as string literals)
<noam> I'm talking conceptually, not about the implementation :)
<andrewrk> so am i
<noam> > managed by the compiler's static data garbage collector
<andrewrk> marler8997, yes that's currently the way to do it
cole-h has quit [Quit: Goodbye]
<marler8997> ok, well, that kinda seems like a similar issue
plumm has quit [Remote host closed the connection]
<noam> andrewrk: the underlying question: every call to a comptime function foo with identical arguments is guaranteed to have an identical result, correct?
cole-h has joined #zig
<noam> Put differently: the only mutable comptime state a function can access is internal?
plumm has joined #zig
dyeplexer has quit [Remote host closed the connection]
vrdhn has joined #zig
<andrewrk> marler8997, in C this is solved by putting other source files on the command line (with separate compiler invocations). there's nothing stopping us from doing that in zig, however I think it's better having a root source file and to have the source code decide what other files to import, specifically because it allows you to use comptime logic to selectively import
<andrewrk> I think in practice status quo is quite reasonable
<marler8997> interesting
<andrewrk> noam, a comptime function call may pass a pointer as a parameter, allowing the function call to mutate comptime state outside of the function scope
retropikzel has joined #zig
<noam> ahhhh right
<andrewrk> comptime function calls that mutate external comptime state are exempt from memoization
<noam> Wasn't there the intent to hide execution order eventually?
<marler8997> here's another idea, what if we included a way to force function to be evaluated but not export it?
<noam> marler8997: `_ = foo;`?
<noam> Is there anything in e.g. stdlib that depends on comptime functions being able to receive pointers to comptime mutable state?
<marler8997> whatever solution we use, I feel like we'd have to be ok with requiring it on helloworld.zig as well
<marler8997> comptime { _ = main }; fn main() void { ... }
<noam> marler8997: why would that be needed?
<ifreund> noam: you want to be able to use std.mem at comptime or not?
<marler8997> right now Zig is hardcoding std.zig to always be evaluated whether or not it is used, which is why helloworld works without comptime { _ = main; }
<noam> ifreund: Which functions would need this?
<marler8997> so if we're saying that we're ok with requiring all users to use comptime { _ = main; }, the why would "std" get special treatment?
<marler8997> if we find value in not requiring the user to include comptime { _ = main; }, then we would be adding that same "value" to third party libraries as well
<ifreund> noam: std.mem.copy() for the most basic example
<andrewrk> marler8997, comptime { _ = main; } wouldn't do anything because it doesn't export anything. if you did export fn main() then it would work and you don't need the comptime
<marler8997> right, unless you imported the module inside main
<marler8997> so in my case, comptime { _ = main; } doesn't cause main to be exported directly, but it causes it to be evaluated which causes @import("gba") to be evaluated which in turn causes start.zig to get evaluated...
<marler8997> it's not a good solution, just thinking out loud at the moment :)
vrdhn has quit [Remote host closed the connection]
<marler8997> more thinking out loud, what if we made "start.zig" the root module for executables?
<marler8997> but no, the root module is where the user can configure things
<marler8997> maybe we should have an "app" module and an "entry" module?
<marler8997> "entry" is the module that always gets evaluated, "app" is where the user defines "main" and whatever else
<marler8997> Ok I'm just back to the "start" idea, I think I'm liking that more now
<andrewrk> what's the "start" idea?
halbeno has quit [Remote host closed the connection]
<marler8997> reserve the package "start" to contain the module that has the export to start the evaluation chain
<marler8997> so basically "std/start.zig" would get set to "start" by default, but could be overriden
<andrewrk> that seems pretty clean but doesn't that effectively move `comptime { _ = @import("gba.zig"); }` to build.zig?
<andrewrk> is that actually better?
halbeno has joined #zig
<marler8997> thinking...
<marler8997> not saying this is the main difference, but this one could be enforced I think, in start.zig, comptime { assert(@import("starg") == @This())) }
<marler8997> the interface is also a bit more explicit/clear I think
<marler8997> right now, std/start.zig works because of 2 things, 1) std.zig is always evaluated and 2) there is a _ = start in std.zig
<marler8997> the issue with gba is we can't really solve 1
retropikzel has quit [Quit: Leaving]
<marler8997> but with an explicit "start" feature, the "start" package always gets evaluated, so now we don't need #2 in std, which divorces std from the startup code
<marler8997> I guess I'm becoming convinced that "start" is special enough to warrant an explicit feature like this, rather than relying on the compiler always evaluating std and the _ = start lines in std.zig
tnorth has quit [Ping timeout: 250 seconds]
<andrewrk> I'm interested in continuing this conversation at some point. Right now I'm going to close IRC and try to get some self-hosted compiler progress done :)
<marler8997> ok, ttyl then
<ifreund> enjoy!
<andrewrk> which, coincidentally, is the part where we make stage2 automatically do `_ = @import("std")` :D
<marler8997> :) lol
aerona has joined #zig
ki9a has joined #zig
pjfichet has joined #zig
<marler8997> if we implemented the "start" package, could we remove the hardcoding in the compiler to always import std.zig?
<ki9a> Hi. I was reading http://www.jakubkonka.com/2021/01/21/llvm-tls-apple-silicon.html ; does anyone know if this bug was reported already to llvm and which mach-o backend of lld is affected?
pretty_dumm_guy has joined #zig
pjfichet has quit [Quit: Connection closed]
xackus has quit [Ping timeout: 240 seconds]
<mikdusan> freebsd 13.0 release is in progress; notable supported tiers changes:
<mikdusan> - 32-bit x86 drops to tier 2
<mikdusan> - 64-bit armv8 (aarch64) bumps to tier 1
jokoon has quit [Quit: Leaving]
wootehfoot has joined #zig
lemur has quit [Quit: Konversation terminated!]
lemur has joined #zig
<g-w1> how does Module.deletion_set get updated? in performAllTheWork, im trying to get the amount of deleted decls by checking `const deleted_decls = mod.deletion_set.count();` but i dont think its working
<g-w1> its just giving 0 in performAllTheWork
<g-w1> *at the end of performAllTheWork
wootehfoot has quit [Quit: Leaving]
<g-w1> eh, i think `update completed: 1/1 decls modified` is good enough
<mikdusan> what the
<mikdusan> note to self: merge before closing pr :)
pretty_dumm_guy has quit [Ping timeout: 240 seconds]
bndbsh has quit [Quit: Connection closed for inactivity]
pretty_dumm_guy has joined #zig
Akuli has quit [Quit: Leaving]
ur5us has joined #zig
ur5us has quit [Remote host closed the connection]
ur5us has joined #zig
lemur has quit [Quit: Konversation terminated!]
paulgrmn_ has quit [Ping timeout: 240 seconds]
klltkr has joined #zig
<Raito_Bezarius> and how to fix this inline chunk of asm?
<Raito_Bezarius> it looks like some data is getting trashed but I'm not sure to understand why
<Raito_Bezarius> nvm, I see it…
lo5 has joined #zig
lo5 has quit [Quit: leaving]
bitmapper has joined #zig
<v0idify> https://fasterthanli.me/articles/i-want-off-mr-golangs-wild-ride has this been shared here already?
<v0idify> some of it could be relevant to the changing of OS API
<v0idify> a bunch of things are already solved or could be solved with zig
nvmd has joined #zig
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
jmiven has quit [Quit: reboot]
aerona has quit [Remote host closed the connection]
aerona has joined #zig
jmiven has joined #zig
pretty_dumm_guy has joined #zig