ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
donlzx has joined #zig
alexnask_ has quit [Ping timeout: 260 seconds]
darithorn has joined #zig
<GitHub55> [zig] andrewrk opened pull request #1215: self-hosted: first passing test (master...self-hosted-first-test) https://git.io/fNTdH
Tobba has quit [Ping timeout: 244 seconds]
isd has joined #zig
wilsonk has quit []
peyty has quit [Ping timeout: 252 seconds]
wilsonk has joined #zig
douglas has joined #zig
v1zix has joined #zig
<v1zix> I looked at the sort function in std.sort and noticed it has helper functions like i32asc, i32desc, etc. for the lessThan parameter but they're not public. Anyone know if there are plans to have helper functions on it for primitive types? I didn't see anything on GitHub issues about it
douglas has quit [Ping timeout: 252 seconds]
mahmudov has quit [Quit: Leaving]
mahmudov has joined #zig
<andrewrk> v1zix, we can make those public if it's helpful. feel free to make a PR
<andrewrk> it should be pretty trivial to define those things in the meantime
<GitHub34> [zig] andrewrk pushed 1 new commit to master: https://git.io/fNkex
<GitHub34> zig/master c620a1f Andrew Kelley: Merge pull request #1215 from ziglang/self-hosted-first-test...
<GitHub125> [zig] andrewrk closed pull request #1215: self-hosted: first passing test (master...self-hosted-first-test) https://git.io/fNTdH
darithorn has quit [Remote host closed the connection]
xtreak has joined #zig
tiehuis has joined #zig
mahmudov has quit [Remote host closed the connection]
<tiehuis> quick note about the sorting, you can create a generic comptime function for every type as needed which would be a bit cleaner
<tiehuis> for example: https://clbin.com/gwyIV
<andrewrk> nice!
<tiehuis> also, would it be worthwhile to change the compare func arguments from *const T to T since the change to how parameters are passed?
<andrewrk> yes I believe that was one of the main motivations
<tiehuis> Might make a quick PR tonight to apply both those changes then
<andrewrk> sounds good, I'll have a look at it in the morning (the morning for me at least)
<tiehuis> also, got that struct idea from tgschultz in the nested function issue
<andrewrk> I really should prioritize that defer scope issue
<andrewrk> where zig tries to generate defers of outer functions for inner functions
<tiehuis> sounds odd, don't think I've come across that yet
<tiehuis> also, i'm thinking i'll add a `--stdin` flag to `zig fmt` since many formatters seem to work a bit nicer when the control the buffer themselves for autoformatting
<andrewrk> sounds reasonable
<andrewrk> tiehuis, have you seen the event loop stuff?
<andrewrk> I'm quite excited about it
<v1zix> tiehuis, very cool! Yeah I thought there might be a way to essentially return a `fn` with a generic function, but wasn't sure on the syntax
<tiehuis> andrewrk: yes! very exciting, will be very cool to see how the self-hosted compiler design continues and the end result
<tiehuis> top-bar of the download page on website is not centered by the way with the last update
<andrewrk> oops
<andrewrk> fixed
<GitHub51> [zig] andrewrk pushed 1 new commit to master: https://git.io/fNkfi
<GitHub51> zig/master c6c4938 Andrew Kelley: self-hosted: add compile error test for missing fn name
isd has quit [Quit: Leaving.]
<GitHub58> [zig] tiehuis opened pull request #1216: Add generic comparator generator functions for sorting (master...sort-improvements) https://git.io/fNkkk
v1zix has quit [Quit: Page closed]
tiehuis has quit [Quit: WeeChat 2.1]
alexnask_ has joined #zig
xtreak has quit [Remote host closed the connection]
xtreak has joined #zig
noonien has joined #zig
xtreak has quit [Remote host closed the connection]
<unique_id> First 1k lines in Zig written, 99k to go :)
zolk3ri has joined #zig
davr0s has joined #zig
xtreak has joined #zig
davr0s has quit [Ping timeout: 240 seconds]
return0e_ has quit [Remote host closed the connection]
dennis___ has joined #zig
dennis___ has quit [Client Quit]
alexnask_ has quit [Ping timeout: 240 seconds]
alexnask_ has joined #zig
xtreak has quit []
Dodo has joined #zig
<Dodo> hi again!
douglasC has joined #zig
<pancake> examples/cat doesnt builds with latest changes in the compiler
<pancake> arent they part of the testsuite?
<douglasC> It built for me. Zig version 0.2.0+8fba0a6a on Windows. Which version are you using?
<douglasC> It also builds on version 0.2.0+2564c546
bheads has joined #zig
Tobba has joined #zig
<douglasC> Examples/cat compiles for me: Zig version 0.2.0+1a0c906e on Windows
Dodo has quit [Quit: Page closed]
<unique_id> What pasting website should I use? I don't know what people use
<unique_id> I'm getting a segfault inside nvidia's vulkan driver for the following zig code but not the equivalent C code. Here is zig: https://dpaste.de/5qov/raw, here is C: https://dpaste.de/orot/raw
<unique_id> The c code returns success
<unique_id> I don't really know how to debug this
<unique_id> "pNext = true" says the debugger, wait a second .........
<unique_id> But I'm setting it to pNext = null
return0e has joined #zig
<unique_id> I'm having a hard time debugging the zig code because even right after explicitly setting info.pNext to null, the debugger prints that info.pNext is 'true'. So... is code gen at fault here? I don't know.
<bheads> try making VkInstanceCreateInfo a packed struct
<bheads> Anything you share with C whould be packed
<wilsonk> Zig also doesn't allow assigning null to something that can't be null...not sure if this holds while true debugging, but it is a language feature that keeps one from shooting oneself in the foot. See https://ziglang.org/documentation/master/#Optionals. Might be relevant there?
<unique_id> wilsonk: What did I assign null that couldn't be null?
<unique_id> bheads: then why does zig translate-c use extern structs extensively?
<bheads> not sure, extern struct is not documented :/ But I have had success with packed structs
<wilsonk> unique_id: just saying that maybe pNext can't be null in the context you are trying to set it...not sure though. Compiler magic might be possible there, is all
<unique_id> ah okay, I'm not :)
<unique_id> and I set it in code, not in the debugger
<wilsonk> Ah, I see. My bad
Ichorio has joined #zig
<GitHub195> [zig] andrewrk pushed 1 new commit to master: https://git.io/fNIv7
<GitHub195> zig/master 3aaf814 Andrew Kelley: Merge pull request #1216 from ziglang/sort-improvements...
<GitHub114> [zig] andrewrk closed pull request #1216: Add generic comparator generator functions for sorting (master...sort-improvements) https://git.io/fNkkk
<andrewrk> unique_id, I like https://clbin.com/
<andrewrk> for pasting
<andrewrk> I'm looking at your pastes now
<andrewrk> unique_id, bheads is incorrect about using packed for sharing with C
<andrewrk> apologies for the lack of documentation - I will address that today - but `extern struct` guarantees ABI compatibility with C
<andrewrk> unique_id, how are you linking against vulkan?
<unique_id> I do: exe.linkSystemLibrary("vulkan")
<unique_id> -lvulkan for gcc
<andrewrk> oh, did you also do libc btw?
<andrewrk> exe.linkSystemLibrary("c")
<unique_id> I did
<andrewrk> hm. I'm not sure what library to install to do that - I get lld: error: unable to find library -lvulkan
<andrewrk> I thought you had to use one of those dynamic loaders
<unique_id> Yeah I was also getting that. Linking "c" makes it find vulkan, why I don't know
<unique_id> No, you can link vulkan. "volk is a meta-loader for Vulkan. It allows you to dynamically load entrypoints required to use Vulkan without linking to vulkan-1.dll or statically linking Vulkan loader."
<unique_id> but you can use things like volk for a slight perf improvement as well as better errors to users, I guess
isaachier has joined #zig
<isaachier> hey just announcing i've been working on a game boy emulator. so far just implemented cpu and instruction set. have to work on graphics and audio but docs on this are pretty unclear. if anyone is interested, here it is: https://github.com/isaachier/gbemu.
<isaachier> obviously written in zig
<unique_id> cool, always nice to have more zig code to look at!
<andrewrk> isaachier, awesome!
<andrewrk> unique_id, are you planning on using glfw, sdl, or something else?
<isaachier> thanks!
<isaachier> relating to SDL, that's what i decided to use too. pretty much works out of the box AFAIK.
isaachier has quit [Client Quit]
donlzx has quit [Quit: Leaving]
<andrewrk> isaachier, if you add a readme I'll link it on ziglang.org
<unique_id> @andrewrk: Just for extra confirmation, if you search for "Vulkan Direct Exports" on this page: https://vulkan.lunarg.com/doc/view/1.0.54.0/linux/LoaderAndLayerInterface.html you can see that linking directly is supported. What you're really linking to is a loader library with trampoline functions
<unique_id> Having said that, and I should have said this sooner, I've also tried using dlopen and it didn't fix my issue
<unique_id> nvm, I still used dlsym so I still went through the loader library
<andrewrk> unique_id, makes sense. I'm just trying to duplicate your setup so I can debug
<andrewrk> got it! confirmed, I can reproduce the problem
<unique_id> awesome, I'm excited to see the bug :)
<andrewrk> looks like zig is generating pNext as a `bool` when it should be a pointer
<andrewrk> ohhh, it's `?*const void` instead of `?*const c_void`
<andrewrk> that's a really unfortunate footgun
<andrewrk> I think I can simply make this a compile error - not allowing pointer to void in extern structs
<andrewrk> ok that fixes it
<unique_id> are you sure that fixes it? I don't remember exactly what I was doing but I was also changing void and c_void around, trying things, which didn't seem to affect anything.
<unique_id> oh it worked
<unique_id> maybe the issue is unnecessary then
<andrewrk> unique_id, it should be a compile error - I'll make that be the case before closing the issue
<unique_id> ok so when I was changing void and c_void around I was dealing with some different issue
<andrewrk> this is a great example of a foot gun that we don't want zig to have
<pancake> douglasC: weird will do a clean build and see, but i had to replace the *os.File for &os.File and such
douglasC_ has joined #zig
<douglasC_> pancake: You on Windows?
<andrewrk> pancake, it sounds like you're looking at a pretty old version of zig
douglasC has quit [Ping timeout: 252 seconds]
<douglasC_> testing
<andrewrk> appveyor tests the examples on windows on every master branch push
<douglasC_> Appveyor then builds a zip file. Easy to download, extract and run it. Very nice.
<unique_id> I feel silly not having read about void sooner. The c++ people have been talking about having something like this. Definitely useful for generic code.
<douglasC_> I am trying to build tetris on Windows. I see that I need libepoxy, GLFW, and libpng. Where do I put them so zig can link to them?
<andrewrk> douglasC_, I've only ever been able to cross compile tetris for windows - there's an open issue for doing it natively: https://github.com/ziglang/zig/issues/576
<douglasC_> Ok, I will try in Linux and cross compile.
<andrewrk> but I haven't tried too hard. you should be able to put them anywhere, and then the problem is just adding to the build script the libraries where they can be found
isaachier has joined #zig
<isaachier> Thanks @andrewrk! I added a really basic README with just the description, but I'll let you know when I do a more thorough one.
isaachier has quit [Client Quit]
<andrewrk> douglasC_, libpng is a regrettable dependency on windows
<andrewrk> I'd love to see a pure zig png library
<douglasC_> andrewrk: i do not see any prebuilt libpng. Can it be built with VS?
<andrewrk> when I did it, I obtained it with the mxe project: http://mxe.cc/
very-mediocre has joined #zig
<MajorLag2> pure zig png is on my todo list
<GitHub49> [zig] tgschultz opened pull request #1219: Added `remove` to ArrayList (master...arraylist-remove) https://git.io/fNIsN
<GitHub151> [zig] andrewrk pushed 2 new commits to master: https://git.io/fNIGF
<GitHub151> zig/master 5954c94 Andrew Kelley: build system: add -Dskip-release option to test faster
<GitHub151> zig/master 3f30897 Andrew Kelley: add compile error for disallowed types in extern structs...
<andrewrk> unique_id, now your zig code example is a compile error, so the next person to run into that issue won't have to deal with a segfault
<andrewrk> thanks for the report!
<andrewrk> it also caught a bug in the standard library having to do with time on darwin
Tobba has quit [Read error: Connection reset by peer]
noonien has quit [Quit: Connection closed for inactivity]
Tobba has joined #zig
bheads_ has joined #zig
bheads has quit [Ping timeout: 268 seconds]
alexnask_ has quit [Ping timeout: 244 seconds]
<unique_id> great!
_whitelogger has joined #zig
davr0s has joined #zig
<GitHub190> [zig] andrewrk pushed 1 new commit to master: https://git.io/fNIEf
<GitHub190> zig/master 9bdcd2a Andrew Kelley: add std.event.Future...
andrewrk has quit [Ping timeout: 264 seconds]
very-mediocre has quit [Quit: Page closed]
andrewrk has joined #zig
bheads__ has joined #zig
bheads_ has quit [Ping timeout: 256 seconds]
redj_ is now known as redj
Ichorio has quit [Ping timeout: 240 seconds]
alexnask_ has joined #zig
douglasC_ has quit [Ping timeout: 252 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
alexnask_ has quit [Quit: Leaving]
zolk3ri has quit [Remote host closed the connection]
<GitHub11> [zig] andrewrk pushed 1 new commit to master: https://git.io/fNIDW
<GitHub11> zig/master 9751a0a Andrew Kelley: std.atomic: use spinlocks...
davr0s has joined #zig