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/
utzig has joined #zig
eddyb[legacy] has joined #zig
<andrewrk> -femit-docs
karrick has quit [Read error: Connection reset by peer]
karrick has joined #zig
<andrewrk> for now it's recommended to use it with `zig test` because the tests tend to reference more decls making more things show up
jzelinskie has quit [Ping timeout: 260 seconds]
jzelinskie has joined #zig
ovf has quit [Ping timeout: 272 seconds]
eddyb[legacy] has quit [Ping timeout: 240 seconds]
<vramana> andrewrk: Should this command work ./zig test -femit-docs ./lib/std/std.zig ?
ovf has joined #zig
eddyb[legacy] has joined #zig
<andrewrk> vramana, I would do: ./zig test ../lib/std/std.zig -femit-docs -fno-emit-bin
<andrewrk> vramana, looks like it will put the docs in the cache directory if you do that, you can use `--output-dir .` to make it put the stuff in a docs/ directory in the cwd
<vramana> andrewrk: Many tests currently fail with error: expected type '*mem.Allocator', found '*std.mem.Allocator'
<andrewrk> I just tried it on latest master branch
<andrewrk> I think you have a collision between 2 lib folders
<andrewrk> make sure you are running the test on the same copy of the std lib that zig uses as its detected std lib path
<andrewrk> (you can check this path with `./zig env`)
<andrewrk> side note, I'm not sure why the std lib cache_hash blake3 hashing of files is so slow
<vramana> andrewrk: The std lib path seems to be inside the build folder. But I now get a different error. ./lib/zig/std/crypto/md5.zig:248:15: error: unable to find 'test.zig'
<andrewrk> the std lib tests require a source checkout
<andrewrk> I recommend to delete your second copy of the zig lib directory and rely only on the one found in the source tree
<vramana> Then how would zig env know it? All I did now was run make install to build the zig binary and using that to generate documentation. Now I should change std lib the zig binary uses to lib/std folder from the source is that what you are saying?
ur5us has quit [Ping timeout: 240 seconds]
nvmd has quit [Quit: Later nerds.]
ur5us has joined #zig
<pixelherodev> What portion of comptime did vexu add earlier?
gpanders has quit [Ping timeout: 240 seconds]
jicksaw has quit [Quit: ZNC is kill]
jicksaw has joined #zig
mgxm has quit [Ping timeout: 272 seconds]
gert_ has joined #zig
mgxm has joined #zig
cr1901_modern has joined #zig
gpanders has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
gert_ has quit [Quit: WeeChat 2.8]
iwq has quit [Ping timeout: 260 seconds]
iwq has joined #zig
cole-h has joined #zig
_whitelogger has joined #zig
<pixelherodev> Ah crap. Worse than the battery capacity being diminished is that the charge time is much *muchhh* higher now. That'll make Zig work a PITA since stage1 is so CPU-intensive :(
<pixelherodev> Guess I just got to stay in range of the buildbuddy at all times :P
hspak has joined #zig
craigo has quit [Ping timeout: 260 seconds]
ur5us has quit [Ping timeout: 240 seconds]
<pixelherodev> Would anyone here be interested in a Gentoo overlay to fix the LLVM issues when building Zig?
doublex_ is now known as doublex
<Ristovski> pixelherodev: What issues? Not that I've attempted to compile Zig myself on Gentoo
<Ristovski> well hmm, I already have llvm 11
<pixelherodev> Ristovski: The Gentoo ebuilds for LLVM 10+ remove important shared libraries that Zig depends on
<Ristovski> pixelherodev: Oh /that/. Yeah I remember hitting that issue with some other software that depends on the libs
<pixelherodev> Which requires a full rebuild with a modified ebuild to work around, currently (this is somewhat ameliorated if ccache is installed with a large enough cache size)
<Ristovski> Yeah I think I just hacked something horrible together in the meantime
<Ristovski> pixelherodev: It was a configuration step flag that enables those, right? (can't remember now)
<pixelherodev> Yep, I did the same thing.
<pixelherodev> twas a hassle, because it required updating the hash
<Ristovski> Ah yes, -DLLVM_DISTRIBUTION_COMPONENTS iirc
<Ristovski> and also -DBUILD_SHARED_LIBS
<pixelherodev> Hmm. I'm thinking long-term instead of making my own distro (as I've discussed in the past), I'd want to write a replacement for portage (probably in Zig, but distributed as C produced via CBE for more convenient builds), and eventually just write ebuilds which depend on IR sources instead of the original source
<Ristovski> As in, it would fetch IR instead of source code for packages?
<pixelherodev> It'd result in, effectively, an upstream-Gentoo-compatible system, distributing per-architecture IR and optimizing it (with -march=native or equivalent) on install
<Ristovski> I see. I think intels clear linux guys thought of doing the same thing, no idea if they ever did anything
<pixelherodev> Native portage (instead of python) means faster dep calculations (which have been annoyingly long on multiple occasions for me), and pre-optimized IR means build times on par with *binary* distros
<pixelherodev> I wouldn't hope to compete with, say, Alpine, but maybe more like Debian install times
<Ristovski> Heh, dependency checks have become so long for me that I remember all the dependencies (for the most common stuff I recompile) myself
<Ristovski> so I just pass --nodep
<pixelherodev> *Ouch*.
<pixelherodev> See that's kinda my point.
<pixelherodev> Portage is the one pain point I have with Gentoo
<Ristovski> Indeed
<pixelherodev> Says a lot that a core feature is the only pain point *and it's still the best OS I've used*
<pixelherodev> Alpine's the only one that comes *close*
cr1901_modern has quit [Quit: Leaving.]
rzezeski has quit [Quit: Connection closed for inactivity]
cole-h has quit [Quit: Goodbye]
dddddd has quit [*.net *.split]
creationix has quit [*.net *.split]
leeward has quit [*.net *.split]
[RMS] has quit [*.net *.split]
marler8997_ has quit [*.net *.split]
haliucinas has quit [*.net *.split]
[RMS] has joined #zig
creationix has joined #zig
dddddd has joined #zig
leeward has joined #zig
haliucinas has joined #zig
marler8997_ has joined #zig
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
drawkula has joined #zig
yeti has quit [Ping timeout: 256 seconds]
iwq has quit [*.net *.split]
mgxm has quit [*.net *.split]
traviss has quit [*.net *.split]
blueberrypie has quit [*.net *.split]
mgxm has joined #zig
iwq has joined #zig
blueberrypie has joined #zig
traviss has joined #zig
kushalp has quit [Ping timeout: 265 seconds]
r0bby has quit [Read error: Connection reset by peer]
procnto has quit [Ping timeout: 260 seconds]
karrick has quit [Read error: Connection reset by peer]
r0bby has joined #zig
procnto has joined #zig
karrick has joined #zig
kushalp has joined #zig
riba has joined #zig
traviss has quit [Remote host closed the connection]
traviss has joined #zig
KoljaKube has joined #zig
riba has quit [Ping timeout: 272 seconds]
<pixelherodev> Wow, ELF loader for SPU II tests was downright trivial :)
<ikskuh> as said
<pixelherodev> Getting it to stop infinite looping is a bit harder :P
<pixelherodev> Hmm. It's infinite-looping :(
<pixelherodev> I mean, in the interpreter :P
<pixelherodev> `Test [1/1] test "self-hosted"...tests [23/23] SPU-II Basic Test [1/1] update [5/4] Infinite loop detected in SPU II test!` Eh, better than before :P
<pixelherodev> Ohhhhh, it's still using four byte pointers in the GOT, so it's getting 0x0000 as the target addr of the function call :P
dingenskirchen has joined #zig
dingenskirchen has quit [Client Quit]
<pixelherodev> ikskuh: got it passing :D
<ikskuh> \o/
<pixelherodev> Pushed :D
<pixelherodev> Just need to address andrew's comments
dingenskirchen has joined #zig
<pixelherodev> ... I have to *rebase it*.
dingenskirchen has quit [Client Quit]
dingenskirchen has joined #zig
<pixelherodev> ... annnnnd suddenly it's broken :(
<pixelherodev> `TODO buf_write_value_bytes maybe type`
<pixelherodev> halp
<ikskuh> comptime bitcast happening?
<KoljaKube> I think I that one before
<KoljaKube> +encountered
<pixelherodev> It's not my fault! Ha!
<pixelherodev> I'm running a bisect, it happens on master too.
<KoljaKube> Yep, still in my clipboard history :D
<pixelherodev> Introduced by 0f677810ea9d5c8ba549f6c9948979a768a1eda6, I think
<pixelherodev> Sure seems like it
<pixelherodev> Going to try rebasing that out of existence :
<pixelherodev> :P
<pixelherodev> tdeo: you on?
<pixelherodev> That commit is definitely the cause.
dingenskirchen has quit [Quit: ZNC 1.7.5 - https://znc.in]
dingenskirchen has joined #zig
<ifreund> anyone able to get zig fmt to make this look nice? https://paste.rs/jX0
<ifreund> it won't let me put a line break before the while
<Nypsie[m]> I'd just give it a named label and break that
<ifreund> actually ended up refactoring this away, was just thinking about opening up an issue
<ifreund> I'd hate to see funky formatting behavior get stabilized and locked in stone
<Nypsie[m]> Doesn't hurt to make things more explicit anyway, instead of a '1-liner'
<pixelherodev> Anyone else have the issue I mentioned in #6115?
<pixelherodev> Ah wait, maybe it's because my Zig is outdated?
<ifreund> I'll try, one sec
<pixelherodev> Updated Zig and I still get that issue
<pixelherodev> No wait, never mind
<ifreund> yeah built fine for me
<KoljaKube> translate(self.cPtr(), @intToPtr([*c]const f32, @ptrToInt(Vec3Type.constCPtr(&v))));, translate is `fn([*c][4]f32, [*c]const f32) callconv(.C) void`
<KoljaKube> error: cast discards const qualifier (pointing at the first @) - am I missing something?
<ifreund> is self const?
<pixelherodev> Woot!
<KoljaKube> self is *Self, so no as I understand
<pixelherodev> andrewrk: SPU backend PR (#6096) is ready for review!
<pixelherodev> :D
<pixelherodev> KoljaKube: that's correct, yeah
<pixelherodev> What does cPtr return?
<pixelherodev> What type?
<KoljaKube> [*c]f32
<KoljaKube> No
<KoljaKube> [*c][4]f32
<Nypsie[m]> pixelherodev: Great work! :)
<pixelherodev> Nypsie[m]: thanks :)
<KoljaKube> But the compiler points at the @, so isn't the second parameter the issue?
<pixelherodev> Stil needs a lot of work for proper support though
<pixelherodev> KoljaKube: Ahh
<pixelherodev> I thought you said "the first *param*"
<KoljaKube> pub const translate = @ptrCast(fn ([*c][4]f32, [*c]const f32) callconv(.C) void, cc.glmc_translate);
<ifreund> uh, is `v` const?
<ifreund> probably need to see more code
<KoljaKube> (I did this because the C code does not use const, but I know the parameter is only read in the function
<KoljaKube> v is Vec3Type
<KoljaKube> So it should be const
<KoljaKube> Which is why I wrote the separate constCPtr conversion
<KoljaKube> I'll gist together the relevant code snippets I guess
<KoljaKube> Not in a way that compiles, but that contains the relevant types: https://gist.github.com/koljakube/2712be82e38561c56f358bccbd21b1e6
<KoljaKube> The int-ptr-casting is only there to make sure that the problem is in the call, and not my implementation of constCPtr()
<ifreund> translate(self.cPtr(), @intToPtr([*c]const f32, @ptrToInt(&v))); <-- does this work?
<KoljaKube> What do you mean?
<KoljaKube> Oh, sorry
<KoljaKube> Nope, same error
<KoljaKube> I didn't see the changes at first...
<pixelherodev> try reducing it to subexprs
<pixelherodev> See if you can narrow down which subexpr causes it
<ifreund> what if you call cc.glmc_translate(self.cPtr() @intToPtr([*c]f32, @ptrToInt(&v)));
<ifreund> i'm not sure the @ptrCast() on the function pointer is sufficent to const-cast the parameter
<KoljaKube> const ps: [*c][4]f32 = self.cPtr(); const pv: [*c]const f32 = Vec3Type.constCPtr(&v); cglm_call.translate(ps, pv);
<KoljaKube> pixelherodev: Like this?
<ifreund> @intToPtr(@ptrToInt()) is the only way to const cast in zig, and I think it's technically UB
<KoljaKube> ifreund: @typeName(@TypeOf(translate)) looks good, does that count for something?
<ifreund> can't say, what's the type of cc.glmc_translate?
<pixelherodev> If you're constcasting, there's probably a problem
<KoljaKube> ifreund: intToPtr(ptrToInt()) and requiring everything to be var is what I'm trying to get rid of
<ifreund> My theory is that you have to @intToPtr(@ptrToInt()) the function itself
<KoljaKube> void glmc_translate(mat4, vec3)
<pixelherodev> ew
<pixelherodev> If you need to do that, try to find a better way to accomplish the task
<pixelherodev> If you need to cast the function type to be able to call it, something *will* break at some point
<pixelherodev> It's just a matter of time
<KoljaKube> Mhkay
<KoljaKube> I had hoped that *adding* const shouldn't be too bad (since I know the implementation, and that it will not change)
<ifreund> maybe you can get a patch merged upstream
<pixelherodev> Adding const should be fine.
<KoljaKube> pixelherodev: But that's what I do
<KoljaKube> ifreund: Just checked, can't intcast the function ptr
dingenskirchen has quit [Quit: ZNC 1.7.5 - https://znc.in]
<KoljaKube> It is apparently a runtime value, I don't want to add actual function pointers
<pixelherodev> KoljaKube: Did you break it down into subexprs?
<pixelherodev> Always double check these things
<KoljaKube> pixelherodev: I wrote something above, because I'm not completely sure what you meant
dingenskirchen has joined #zig
<KoljaKube> ifreund: The thing is, the library has a lot of functions, and does not use const. I would need to annotate all functions for that to make sense
<pixelherodev> KoljaKube: exactly that
<KoljaKube> Which is why I hoped to just add the const in zig to all the functions I actually use
<KoljaKube> Error points at the p in pv inside the call
<pixelherodev> instead of `a(foo(), bar())`, you split the foo and bar out of it
<KoljaKube> So, no additional information, aside that constCPtr does it's job
<KoljaKube> I'm not the only one with that idea, but apparently const in C is problematic or something? https://github.com/recp/cglm/issues/83
<KoljaKube> I guess I'll stick to staying const-correct in zig and intcasting away the const when calling C
<pixelherodev> KoljaKube: the issue that you linked is the other way around
<pixelherodev> They were trying to pass const values to non-const params, which is (of course) invalid
<pixelherodev> There's nothing problematic about const in C
<KoljaKube> The referenced PR (86) marks the correct parameters as const
<KoljaKube> - glm_translate(mat4 m, vec3 v) {
<pixelherodev> Yes... and?
<KoljaKube> + glm_translate(mat4 m, const vec3 v) {
<KoljaKube> Maybe I misunderstood "other way around"
<pixelherodev> Adding const to a parameter that isn't modified is never an issue
<KoljaKube> Sure
<KoljaKube> Then they didn't manage to call their functions correctly afterwards, I guess?
<KoljaKube> Ah well, worst case I will need to actually make some things var instead of casting there in the future, best case I can remove the casts if the code is changed upstream
<KoljaKube> I happy for a short time when the compiler accepted by function cast ;-)
waleee-cl has joined #zig
<KoljaKube> From a technical perspective, does it make sense that packed unions are align(1)? That would make their contents unusable in some circumstances, wouldn't it?
<fengb> You can manually align the first element to force the struct alignment
<KoljaKube> Not for unions
<KoljaKube> Not yet, anyway
<KoljaKube> normal unions inherit, but packed ones don't
<fengb> Oh right
<KoljaKube> Can I align an array on instantiation? https://godbolt.org/z/xxaYvG
<fengb> You can declare alignment on foo: `const foo align(16) = make()`
<fengb> Wait I think it’s after all the types? `const foo: [4]f32 align(16)`
<fengb> Memory locations are aligned, not values so you can’t return aligned data but you can set it into an aligned variable
craigo has joined #zig
<KoljaKube> Ah, OK, so alignment is not directly part of the type system, but every type has a default alignment?
<fengb> It exists on memory locations only, so pointers and variable declarations
<fengb> Fixing alignment usually involves copying the data into a new aligned variable
drawkula is now known as yeti
<KoljaKube> OK, I wasn't clear on where the information is stored in Zig
xackus_ has joined #zig
<scientes> KoljaKube, zig is a static language, this still is only known when the program is compiled, not after
<scientes> *stuff
<pixelherodev> alexnask[m]: good news! That bug I mentioned (off-by-one line numbers in LSP) is a kak-lsp bug, not a ZLS one
<pixelherodev> It occurs with ccls as well
dec05eba has joined #zig
dingenskirchen has quit [Quit: ZNC 1.7.5 - https://znc.in]
dingenskirchen has joined #zig
<KoljaKube> scientes: What I meant was: https://godbolt.org/z/Y8z5oo
dingenskirchen1 has joined #zig
dingenskirchen1 has quit [Client Quit]
rzezeski has joined #zig
dingenskirchen has quit [Quit: ZNC 1.7.5 - https://znc.in]
heitzmann has quit [Quit: WeeChat 2.9]
dingenskirchen has joined #zig
heitzmann has joined #zig
wootehfoot has joined #zig
xackus_ has quit [Ping timeout: 256 seconds]
wootehfoot has quit [Read error: Connection reset by peer]
<protheory8-new-m> How do I use async to do something useful in Zig?
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
<ifreund> protheory8-new-m: that's a pretty broad question, do you have a specific goal?
<protheory8-new-m> No, not really
<ifreund> you may have already seen it but this talk gives a good high-level intro https://www.youtube.com/watch?v=zeLToGnjIUM
<ifreund> andrew also made a video demonstrating a basic chat client/server using async a while back: https://www.youtube.com/watch?v=aDd0BexKWps
<ifreund> in general though it's easier to have a problem and look for a tool than have a tool and look for a problem
<protheory8-new-m> Thanks, I'll check it out
cren has joined #zig
cole-h has joined #zig
KoljaKube has quit [Ping timeout: 272 seconds]
cren has quit [Ping timeout: 246 seconds]
nephele has joined #zig
xackus_ has joined #zig
cren has joined #zig
fraktor has joined #zig
dec05eba has quit [Quit: Leaving]
nvmd has joined #zig
traviss has quit [Remote host closed the connection]
traviss has joined #zig
cren has quit [Ping timeout: 240 seconds]
dingenskirchen1 has joined #zig
dingenskirchen1 has quit [Remote host closed the connection]
sawzall has quit [Read error: Connection reset by peer]
LanceThePants has joined #zig
_whitelogger has quit [Ping timeout: 240 seconds]
decentpenguin has quit [Ping timeout: 240 seconds]
Yardanico is now known as Yardanico_
Yardanico_ is now known as Yardanico