ChanServ changed the topic of #zig to: zig programming language | | be excellent to each other | channel logs:
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 265 seconds]
forgot-password has joined #zig
dimenus has quit [Read error: Connection reset by peer]
dimenus has joined #zig
kllr_sbstn has quit [Remote host closed the connection]
forgot-password has quit [Ping timeout: 265 seconds]
forgot-password has joined #zig
lunamn has quit [Ping timeout: 268 seconds]
lunamn has joined #zig
forgot-password has quit [Ping timeout: 276 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 265 seconds]
forgot-password has joined #zig
marijnfs has quit [Ping timeout: 276 seconds]
<keithdc> I'm importing some c headers that have enums where a value is used for multiple tags (I.e enum Example {A = 0, B = 0}) and it's causing compile errors. Any advice on what I should do to get around this? I could modify the headers to remove conflicts but would be tedious..
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
traviss has joined #zig
<traviss> how can i create a union instance from a runtime known tag? @unionInit and @field both require a comptime known tag. i found a way, but its messy: . there must be a better way?
forgot-password has quit [Ping timeout: 265 seconds]
forgot-password has joined #zig
<traviss> keithdc: is the error something like 'enum tag value already exists'? did you see this issue ?
<keithdc> Yup, that's the one. That's fine, I'll manually remove the conflicts for now. Thanks.
<traviss> i saw andrew ran into a similar issue in his 'porting vulkan tutorial' video. i can't remember exactly what he did. this is close to where he runs into the problem:
<traviss> i believe he used `zig translate-c` and then cleaned up the resulting zig code.
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
<keithdc> Yeah, that's probably a good idea. I watched it but don't think I finished it, I'm pretty much doing the exact same thing.
forgot-password has quit [Ping timeout: 276 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 245 seconds]
forgot-password has joined #zig
lunamn has quit [Quit: leaving]
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen1 has joined #zig
dingenskirchen1 is now known as dingenskirchen
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
Ichorio_ has joined #zig
Jezza__ has quit [Ping timeout: 250 seconds]
muffindrake has quit [Ping timeout: 245 seconds]
muffindrake has joined #zig
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
doublex has quit [Ping timeout: 265 seconds]
forgot-password has quit [Ping timeout: 268 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 252 seconds]
forgot-password has joined #zig
keithdc has quit [Quit: leaving]
chemist69 has quit [Ping timeout: 276 seconds]
chemist69 has joined #zig
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
_whitelogger has joined #zig
doublex has joined #zig
rjtobin has quit [Quit: Leaving]
redj has quit [Read error: Connection reset by peer]
redj has joined #zig
forgot-password has quit [Ping timeout: 268 seconds]
forgot-password has joined #zig
<daurnimator> mq32: FYI reading a socket and reading a file unfortunatly *are* different. though read() and write() work on both; in certain circumstances sendmsg()/recvmsg() have different effects
bakedpineapple has joined #zig
forgot-password has quit [Ping timeout: 265 seconds]
bakedpineapple has quit [Quit: Lost terminal]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 276 seconds]
forgot-password has joined #zig
doublex has quit [Ping timeout: 250 seconds]
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 240 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 276 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 265 seconds]
forgot-password has joined #zig
doublex has joined #zig
forgot-password has quit [Ping timeout: 240 seconds]
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
<Pistahh> can someone pls explain these errors :)
<daurnimator> Pistahh: I'm confused a bit.... I didn't think godbolt ran on windows.....
<daurnimator> Pistahh: unrelated: why did you say your main returns anyerror?
<Pistahh> daurnimator: this is the error I see when I run it on (arch) linux too.. thats why it is so weird :)
<Pistahh> daurnimator: dunno, probably copypasted from somewhere.. just starting with the language, I'M not always quite sure I do the best thing :)
<daurnimator> Pistahh: *most* of the time you should just use `!void` for your main signature and let the error set be inferred.
_whitelogger has joined #zig
_whitelogger has joined #zig
achaninja has joined #zig
<achaninja> Hi there
<achaninja> are there any really simple wrapper libraries for zig that just wrap the posix apis
<achaninja> directly
<achaninja> just adding error handling on top of things like waitpid
<Pistahh> achaninja: there is an std.os.linux.waitpid, but it uses the syscall directly. I'm a zig noob so I may tell lies :) and hope others will correct me, zig by default tries not to rely on libc, so it cannot wrap the libc defined waitpid
<Pistahh> achaninja: when trying to answer questions like yours for yourself, I find it very useful to grep (ripgrep) the zig sources for answers.
<achaninja> except my question was about a library
<achaninja> e.g. external to the sources
<achaninja> but sure
<achaninja> I actually searched in the documentation, but the waitpid definition was grayed out as it has no doc comment and is not tested
<daurnimator> achaninja: most of it is going into std if that's your question
<daurnimator> achaninja: its probably just missing tests/docs. std.os.waitpid should work I think?
<achaninja> it doesn't return zig error types
<achaninja> which was sort of what my question was, I knew I can call c headers from zig
<achaninja> I suppose the answer is that std.os.linux will provide it once its had more polish
<daurnimator> achaninja: I think that's because waitpid can't actually error
<achaninja> no thats not correct
<daurnimator> achaninja: howso?
<achaninja> because it can return errors?
<gonz_> File a bug
<daurnimator> achaninja: what errors?
<daurnimator> achaninja: the only errors are essentially for invalid input; so the zig wrapper there assumes they'll never happen
<achaninja> there are lots of reasons why you could end up waiting for a process that doesn't exist outside your control.
<daurnimator> achaninja: like what?
<gonz_> "If there are no children not previously awaited, -1 is returned with errno set to ECHILD". Non-zero is specifically cited as being errors.
<daurnimator> gonz_: ??
<achaninja> if you are pid 1 and want to check for zombies for example
<gonz_> I don't see how you can claim it doesn't return errors when the documentation gives clear examples of errors being returned.
<daurnimator> achaninja: that would be wait() though; not waitpid()
<achaninja> waitpid(-1)
<daurnimator> ah I see waitpid() can take a -1.
<daurnimator> I don't think that was considered for the zig wrapper
<gonz_> in "Return Values" has clear examples of error return values for each of the variants.
<daurnimator> gonz_: yes; and the zig code I linked above explains why each of them is ignored/unreachable. (and EINTR is handled by repeating the wait)
<achaninja> its not unreachable though
<achaninja> but anyway, it can be fixed
<achaninja> I also think automatically handling EINTR is not helpful
<achaninja> because sometimes if you are doing low level programming, you actually need the EINTR
<achaninja> because you got interrupted
<daurnimator> achaninja: in those circumstances you would usually reach for the lower level os-specific interface, e.g. os.linux.waitpid
<achaninja> umm
<achaninja> that code is os.linux.waitpid
<daurnimator> that code is os.waitpid
<achaninja> oh sorry
<achaninja> my mistake
<achaninja> ah im sorry
<daurnimator> achaninja: its only unreachable if you pass -1 or 0 as the pid. I think it would be sensible for zig to assert the pid argument is not 0 or -1; and provide another function wait() that does the non-specfic-pid bits that *does* handle ECHLD
<achaninja> yes, for os its ok.
<achaninja> I somewhat disagree with the term 'unreachable'
<achaninja> i think 'unexpected'
<achaninja> though i guess its programmer intent
<daurnimator> achaninja: how would it be reachable under documented usage (assume we document that -1 and 0 are not valid input; and say that the pid must exist)
dingenskirchen has quit [Remote host closed the connection]
<achaninja> because you might be in a multithreaded application who waits for a pid when you don't expect
dingenskirchen has joined #zig
<achaninja> its a bug yeah, im just talking about the terminiology
<daurnimator> achaninja: that would be a race condition in your application
<achaninja> I know
<achaninja> but thats why I disagree with the term unreachable haha
<achaninja> so anyway
<achaninja> std.os.linux is unadorned C api
<achaninja> std.os has zig errors but is not the linux api
<achaninja> is there a location for the raw linux api, but with error values
<daurnimator> achaninja: no I don't think so..... cause then it's not "raw" any more
<achaninja> yeah, I guess errors.EINTR
<achaninja> for example
<achaninja> The reason I ask is because Im looking at porting some fairly low level code
<achaninja> and improved error handling would be nice
<achaninja> I guess I can wrap them myself
<daurnimator> achaninja: assuming we add an `assert(pid != 0 and pid != -1)`, how is the std.os wrapper not suitable for you? (you're passing 0/-1?)
<achaninja> it depends on the application. The last 3 things i wrote were an init daemon, a sandbox, and a shell. In those 3 cases it was more useful to just have the C api exactly as it's specified.
<achaninja> but C error handling sucks
<achaninja> I don't mind though, what zig does is sensible
<achaninja> I was mainly just trying to find out if someone had done that as a library, thats all.
shakesoda has quit [Quit: Connection closed for inactivity]
<gonz_> Does the docs generation also have a static mode to generate a set of docs from a project? It'd be interesting to have static pages, plus it might be useful for things like Zeal/Dash(?).
<daurnimator> gonz_: yes... that's pretty much what it does
<gonz_> Not according to the demo
<daurnimator> hmm?
<gonz_> it's using JavaScript with just a static frame that's filled in
<gonz_> so it's pretty much the opposite
<gonz_> I haven't watched the whole demo
<daurnimator> The build process emits a .json file with all the docs/details. The doc page itself is generated (yes at runtime) from that
<gonz_> but what andrewrk was demoing so far is the opposite of a bunch of static pages
<daurnimator> Usually "static" in a web context means "doesn't require server roundtrips" not "no javascript"
<gonz_> Fair enough, I don't particularly care about the definition. Executing JS unnecessarily would complicate addition to things like Zeal/Dash, AFAIK, so that's the operative part.
jjido has joined #zig
<gonz_> In general there ought also to be an option that can be passed to do the rendering work beforehand regardless.
jjido has quit [Quit: Textual IRC Client:]
forgot-password has joined #zig
ky0ko has joined #zig
jjido has joined #zig
jjido has quit [Client Quit]
_whitelogger has joined #zig
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
achaninja has quit [Remote host closed the connection]
<scientes> daurnimator, it can be no javascript too
<scientes> but yeah, more like static backend, static frontend
jjido has joined #zig
kenaryn has joined #zig
<kenaryn> Hello, please what does it mean "token/tokenize/tokenisation"? e.g. Zig has line-independant tokenization, a \\ token, each line of code can be tokenized out of context, etc.
frmdstryr has quit [Ping timeout: 265 seconds]
<Sahnvour> kenaryn: tokenization is the process of identifying _tokens_ (strings, identifiers, operators, keywords ...) in an input string, based on language rules
forgot-password has quit [Quit: leaving]
<kenaryn> Thank you Sahnvour, it seems like an exhaustive definition!
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<daurnimator> Pistahh: oh. I figured out your issue: printing a File currently requires evaluating all the method signatures in the struct; which includes windows things..... which aren't available on non-windows.
<daurnimator> Pistahh: stop printing File and you'll be fine :P
<mq32> is an allocator allowed to @panic if i try to release an object not allocated with the allocator?
<daurnimator> mq32: sure.
<daurnimator> mq32: unreachable (and hence nose demons in release mode) would be expected IMO, so a @panic is one level nicer
mahmudov has joined #zig
<mq32> okay, good
<mq32> i'm writing a "bitmap allocator"
<mq32> or do we have that in std already?
<mq32> so "all objects have the same size"
<mq32> and you have a fixed number of objects
<daurnimator> mq32: with multiple bucket sizes?
<mq32> no, fixed bucket size
<mq32> hmm. i can probably make that even dynamic…
<mq32> have to think about it a moment, if i need "full dynamic" allocation
<daurnimator> mq32: might be able to write a "single size" implementation that takes a size as a parameter; then we can stack several together
<mq32> oh that sounds good :D
<mq32> beeing on freestanding sure has it's ... implications :D
<daurnimator> mq32: FWIW if you're looking to write things to make a good allocator; the thing we need most right now is a radix tree
<mq32> for now i'm happy with "i can do alloc(FixedObject)" ^^
jjido has joined #zig
lunamn has joined #zig
mahmudov has quit [Ping timeout: 268 seconds]
deesix has joined #zig
<daurnimator> oh my.... I made a discovery of a new idiom I think
<daurnimator> `pub const myclass = struct { somefield: usize, usingnamespace if (x) struct { pub fn foo() void {} } else struct { pub fn bar() void {} }; pub fn othermethod() void {} };`
<mq32> okay?
<mq32> what is your usecase?
<tgschultz> using a bitmap for that kind of allocator is probably slower than a freelist.
<daurnimator> mq32: method signatures that differ based on comptime parameter
<daurnimator> or even different method names
<mq32> i was sad to discover that @Type() for enums isn't implemented yet :D
<mq32> otherwise i could create my scancode tables *with* fitting enumeration @ comptime
<Sahnvour> daurnimator: interesting, works with fields too ? mixins in zig then ?
<daurnimator> Sahnvour: no fields. "method-only-mixins" you could call it
<mq32> Sahnvour: no, for "field mixing" there's a quite interesting proposal, but nothing that is settled yet
<mq32> oh.
<mq32> I love Zig :)
<mq32> for(screenBuffer) |row, y| { for(row) |*pixel, x| { pixel.* = render(x,y); } }
<scientes> mq32, isn't that a little slow?
<mq32> why should it?
<mq32> it should do the same as iterating manually
<scientes> yeah but you want polyhedral optimizations
<scientes> and multi-threading
<scientes> and SIMD
<scientes> and all sort of optimizations for that sort of thing
<mq32> scientes: I have freestanding x86 ;)
<mq32> i don't have SIMD and especially i don't have threads :D
<scientes> x86 has SIMD
<mq32> oh wow
<mq32> yeah ,the pentium iii has SSE :D
<scientes> and MX before that
<scientes> on AMD cores
<scientes> k6
<mq32> yeah but for rendering text: i don't care for performance
<scientes> ahhh rendering text
<mq32> i render 320x200 pixels :D
<scientes> well fonts are their own thing
<mq32> i can pretty much ignore *ALL* optimizatoins and still be fast enough
<scientes> but i guess you are using one bit rendering
<scientes> that code just looked alot like ray tracing
<mq32> it's just a usual render loop ;)
<mq32> i code pretty much all my rendering like that
<mq32> except for when i know that i don't have to access all pixels anyways
<mq32> like when doing particles or sprites
<scientes> I don't know much about graphics, but i don't think bit-bliping is common
<scientes> cause its so slow
<scientes> faster stuff is all double rendering and page flipping
<mq32> that is orthogonal to each other
<mq32> i have my font as 1 bit data
<mq32> as it's much smaller than 8 bit per pixel
<scientes> also tracking of when data changes
<mq32> well, we'll see how this project turns out
<mq32> :D
<scientes> no it seems fine
<scientes> cause you are pushing so little datat
<mq32> yeah
<scientes> this isn't 10-bit-depth 4K at 60hz
<mq32> definitly not
<daurnimator> Can you pass an async function as a comptime parameter?
<daurnimator> Hmm.... how should a user pass in e.g. "onXYZ" callbacks?
<mq32> btw: The Ziguana is now travelling in southern germany:
<daurnimator> ah ha I see in InStream.... `pub const ReadFn = if ( async fn (self: *Self, buffer: []u8) Error!usize else fn (self: *Self, buffer: []u8) Error!usize;` .... how ugly :(
<scientes> mq32, how do i get one of those stickers?
<mq32> travel to stuttgart/germany and visit shackspace :D
<scientes> my laptop has zero stickers
<scientes> travel in europe is too expensive
<daurnimator> yeah I've always not liked putting stickers on my laptops
<mq32> i have printed them at
<scientes> you have to fly everywhere
<daurnimator> scientes: compared to where?
<scientes> Peru and Bolivia
<daurnimator> scientes: I drove everywhere last time. was pretty cheap $ wise. But train would have given me time to work....
dimenus has quit [Read error: Connection reset by peer]
<scientes> daurnimator, I am in London Luton airport ATM
dimenus has joined #zig
<Pistahh> daurnimator: yes that indeed explains it, thanks :) it would be nice though if the compiler gave more frieldly indication of the issue :)
<scientes> that is pretty cool
<daurnimator> mq32: Sahnvour: the usecase where I discovered the usingnamespace mixin thing:
<mq32> this is nice!
<scientes> I just wrote a slick bisection of variable-length strings (with reserved character, like UTF-8 or null-terminated has)
<daurnimator> scientes: utf8 doesn't really have a reserved character. it's got an invalid range...
<scientes> daurnimator, \xfe and \xff
<scientes> and also \xfd and \xfc
<scientes> and IIRC \xfb and \xfa
<Sahnvour> daurnimator: pretty slick
<Sahnvour> closer and closer to reification :)
<daurnimator> scientes: \xc0, \xc1 and \xf5-\xff
<daurnimator> scientes: but well formed utf8 is more than that.. e.g. you need to check the leading codepoint indicates the correct length. and that all continuation bytes have the continuation sequence
<scientes> ahh yes, but only \xff and \xfe in the original definition
<daurnimator> scientes: "original".... being superceded in general by 97 and officially in 2003.
<scientes> anyways, its easy to pass the reserved byte in a register
<daurnimator> scientes: but there's many reserved bytes here.... how is that helpful?
<scientes> and escaping is possible, but doesn't seem needed
<scientes> daurnimator, the string set is comptime
<scientes> so you just pick what works
<daurnimator> then what does passing in a register mean?
<scientes> is there anything like ? : GNU extension?
<scientes> oh yeah "else"
<scientes> "orelse"
forgot-password has joined #zig
forgot-password has quit [Client Quit]
<daurnimator> how can I turn a *T into a slice of length 1?
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<daurnimator> `@ptrCast([*]T, x)[0..1]` I guess?
mahmudov has joined #zig
<mq32> daurnimator, yeah that's afaik the "official way"
deesix has quit [Ping timeout: 265 seconds]
<daurnimator> TIL our current out stream can't indicate a partial write...
Akuli has joined #zig
protty has joined #zig
<protty> Does anyone know how you could go about exiting and thread and decommitting its stack without creating a new thread?
<daurnimator> protty: well how did you create the thread?
<protty> by using a custom stack for clone()
<protty> was thinking of using @newStackCall to switch to a different stack, decommit the old one and then pthread_exit() or similar. But couldnt figure out where this new stack would live
<daurnimator> protty: generally whoever creates something is responsible for deleting it
<daurnimator> ==> whatever spawned the thread should be responsible for waiting on it
<protty> the spawner in this case doesnt join() until much later on as it does other work in between. thread stacks being recycled during that work and wanted to decrease memory usage of old stacks if possible
gsomix has joined #zig
batmanaod has joined #zig
<protty> oh pthread_exit() is thread safe. might have an idea now. sorry for the rubber ducking..
<daurnimator> hmmmmmm. `usingnamespace Mixin(Self);`
<daurnimator> Where `Mixin` could be something like: `fn Mixin(Self: type) type { return struct { pub fn foo(self: *Self) void {} pub fn bar(self: Self) usize { return self.otherThing(); }; } }`
<daurnimator> idea: `InStream` could be a Mixin => it assumes that `` exists; and adds in all the other utility `readXYZ` methods
<daurnimator> andrewrk: ^ did I stumble on good? :)
<nrdmn> mq32: are you going to bring stickers to 36c3?
<protty> daurnimator: is that like `impl` trait extensions in rust?
<daurnimator> protty: I'm not familiar with those in rust; so can't say
<andrewrk> hi protty
<protty> ello andrewrk
shakesoda has joined #zig
<daurnimator> I think the above scheme would remove the need for stack_size_std_io_InStream....
<andrewrk> daurnimator, we can avoid that hack (and the error set annoyances!) if we avoid runtime-known function pointers
<daurnimator> andrewrk: exactly; the Mixin strategy I mention above would do that!
<andrewrk> that's definitely worth looking into
<daurnimator> I think I'll have a go at it
<andrewrk> the only downside is that apis which want to accept a stream will have to take a `var` (which is currently already true because of the error set)
<daurnimator> not now.... its 4:30am and I've spent all night thinking about std.fifo :P
<andrewrk> but that might be worth it because that stack size thing is really bad
<daurnimator> andrewrk: yes it would; is the solution for that.
<andrewrk> it addresses some of the issues but I wouldn't call it a full solution
<shakesoda> i asked yesterday, but is there a reasonable way with builder to generate a config.h for a dependency in place of whatever its original build system would make
<shakesoda> i saw some stuff for getting output h path but it errored out when i tried to use it
<andrewrk> shakesoda, there is not a high level convenient API yet but you can use the build script to build & run a .zig file which generates your config.h file
<andrewrk> this will give you @import("build_options")
<andrewrk> also happy to accept PRs to improve the build system API
<shakesoda> andrewrk: thanks, i'll see what i can come up with
adam98 has joined #zig
clktmr has joined #zig
SimonN has quit [Remote host closed the connection]
forgot-password has joined #zig
adam98 has quit [Ping timeout: 268 seconds]
mikdusan has quit [Quit: WeeChat 2.5]
<shakesoda> is it documented anywhere how to deal with linking in windows deps? for example i need user32.lib, opengl32.lib etc and i'm not sure what to do about it
<andrewrk> foo.linkSystemLibrary("user32")
<shakesoda> hmmm, i tried that, maybe i put it on the wrong thing
rjtobin has joined #zig
<shakesoda> i seem to be ending up here when i try that
<andrewrk> shakesoda, hmm that seems like a bug. are you able to learn what the error is in this case?
doublex has quit [Ping timeout: 276 seconds]
<andrewrk> (side note: zig should be improved to treat that situation the same way it does as `catch unreachable` so that you can see the error return trace)
<shakesoda> andrewrk: i'm not sure what the real error is, my guess is hitting the else case in the error switch in linkSystemLibraryPkgConfigOnly and passing that through
<shakesoda> if i change the else => unreachable to else => {} i get further, at least
<shakesoda> actually, i can successfully link if i do that
<andrewrk> shakesoda, change it to else => |e| e catch unreachable,
<shakesoda> trying
<andrewrk> as a temporary workaround, so that it gives you an error return trace
<andrewrk> maybe you need @as(anyerror!void, e) catch unreachable
<shakesoda> does that need a git build? that fails on 0.5.0
<andrewrk> there have been multiple bug fixes related to the code you are looking at since 0.5.0
<shakesoda> okay, i'll update and see how it goes
<lunamn> andrewrk: question regarding #3635, would Address.initUnix stay as-is with returning error.UnsupportedOS?
<lunamn> I forgot to replace its switch on builtin.os to using has_unix_sockets and thought about that for a bit
jjido has joined #zig
doublex has joined #zig
<shakesoda> andrewrk: @as(anyerror!void, e) catch unreachable works with master, big trace now which is showing me windows.CreateProcessW throwing error.FileNotFound (presumably for pkg-config) ...
<shakesoda> andrewrk: but that should be handled already...
<shakesoda> looks like this is what *should* be happening, but it's somehow still ending up in the else
<andrewrk> lunamn, I think you can simply remove that switch, and allow the programmer hit a compile error if os.sockaddr_un is not defined
<andrewrk> shakesoda, the error return trace should show how the error gets propagated. can I see the full trace?
<shakesoda> sure, one moment
<lunamn> andrewrk: done, #3635 is ready, feel free to review again
<shakesoda> ah, i missed the line on top: it's getting error.InvalidName
<shakesoda> here's the trace though
<andrewrk> shakesoda, yeah the earlier lines are errors that were hit, but handled
<andrewrk> a bit confusing, but at least all the information you need is there
<shakesoda> my zig-fu needs work
<shakesoda> :)
<andrewrk> shakesoda, ok I think the problem is at getPkgConfigList, it's not detecting that the pkg-config binary did not execute successfully
protty has quit [Remote host closed the connection]
protty has joined #zig
<andrewrk> shakesoda, can you try this patch?
<andrewrk> lunamn, thanks for the PR! will merge soon
<andrewrk> have you been trying out your patch locally?
wootehfoot has joined #zig
<andrewrk> I'll solve the SIGPIPE problem soon. I've been discussing with Rich Felker the best way to handle this
<shakesoda> andrewrk: that works
SimonNa has joined #zig
<andrewrk> shakesoda, ok, I'll push to master
<lunamn> andrewrk: yep, it works, at least on linux :P
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has joined #zig
<Pistahh> daurnimator: btw, you asked why I used anyerror on fn main.. well, zig init-exe generates it :P :D
<andrewrk> anyerror!void is a perfectly reasonable return type on main
<shakesoda> i'm trying to throw around some c function pointers and i'm not entirely sure how to address this error: expected type 'extern fn([*c]const u8) ?*c_void', found 'extern fn([*c]const u8) ?extern fn() void'
<shakesoda> i see some optionals involved, but have no idea how to convince it that yes i did mean that
Akuli has quit [Quit: Leaving]
doublex has quit [Ping timeout: 276 seconds]
<andrewrk> arguably that type coercion should be allowed
<andrewrk> but you can work around with @ptrCast
<andrewrk> I suggest [*]const u8 instead of [*c]const u8 though. assuming that's a c string
<shakesoda> doesn't it need to be *c? i'm passing this between two c libraries
<andrewrk> [*c] exclusively exists for auto-translated code.
doublex has joined #zig
<shakesoda> both the struct and the function i'm pointing to are from auto-translated c files
<shakesoda> it's also working now, thank you
<andrewrk> your source file is not auto translated c code. so there should be exactly 0 instances of [*c]
<shakesoda> hm, but if i try to drop the *c it gets mad at me
<andrewrk> can I see?
<shakesoda> if the ptrcast uses [*c] it builds and works fine, here
<andrewrk> shakesoda, isn't there hints after the errors?
<shakesoda> it gives me a cannot cast because it could have null values which are illegal in [*]
<andrewrk> it's a really good clue
<andrewrk> [*c] is not the answer
<andrewrk> (also, it would have saved me some time if you included the notes in the error paste earlier, I had to type out the example to get the extra information)
<andrewrk> the zig build fix is pushed to master
<shakesoda> sorry, was just trying to keep noise down in the log
<andrewrk> no problem
<shakesoda> for the apis i am passing these between, it's completely legal for the pointers to be null, and i don't use anything in this struct in my code
<shakesoda> i certainly don't believe *c to be the right answer in anything i am using myself
<shakesoda> zig is very clear to me about this lol
<andrewrk> if they can be null then use optional pointers
<shakesoda> i'm reading it, will try that
<andrewrk> `?[*]const u8` "optional unknown-length pointer to constant elements of type u8"
<shakesoda> yeah, that builds for me
<shakesoda> ?*const u8 worked too, but that is wrong
<shakesoda> andrewrk: thanks, this makes sense
<andrewrk> np
<shakesoda> is there a cleaner way to or flag values together defined in an enum in c header than a ton of bitcasts? this solution seems a bit heavy handed:
<andrewrk> that also has the disadvantage of using runtime state instead of keeping everything comptime
<andrewrk> I think that should be compile error too, the proper cast here is @enumToInt
<shakesoda> that certainly sounds better, although i think it makes sense that bit cast at least builds
ltriant has joined #zig
<andrewrk> C lets you implicitly cast an enum value to an int. zig doesn't. so you have to use @enumToInt in this case
batmanaod has quit [Ping timeout: 245 seconds]
<andrewrk> type theory wise, enum values are not bit flags. it's not really correct for that .h file to do that
<shakesoda> that's reasonable, seems i still have to bitcast back to the flag type too
<andrewrk> @intToEnum
<shakesoda> crashes my program
<shakesoda> i tried that one first
<shakesoda> crashes with invalid enum value, which makes sense
<shakesoda> since what the function is actually taking isn't represented in the enum any longer
<andrewrk> ah. yeah this is why flags should not be enums
<shakesoda> i can accept the bitcast, i should make a note to myself to make the typing more sound on this api in the future
<shakesoda> enums with bit flags aren't that uncommon, but i should certainly drop the enum type when it's expected to pass things which can't be represented with it anymore
<shakesoda> s/pass/accept/
doublex has quit [Remote host closed the connection]
doublex has joined #zig
_whitelogger has joined #zig
kllr_sbstn has joined #zig
kllr_sbstn has quit [Quit: leaving]
forgot-password has quit [Quit: Leaving]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has joined #zig
<mq32> aaah, by code broke with the latest update
<mq32> @as is a thing now, good to know
<andrewrk> mq32, here are some notes:
<mq32> i think i found a regression in std.fmt.formatIntBuf
<mq32> also: thankfully, @as can be fixed with search-and-replace
<mq32> i just replaced ... 100 casts :D
clktmr has quit [Ping timeout: 246 seconds]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mq32> oh
<mq32> arrays are brokenish when using multidim arrays in packed contexts
<mq32> do arrays still enforce some alignments?
tyler569 has quit [Ping timeout: 265 seconds]
<mq32> andrewrk: that was a fast merge... *grin*
tyler569 has joined #zig
<companion_cube> you mean 😁
<mq32> error: attempt to read 1752 bytes from [1758]u8 at index 8 which is 1750 bytes
<mq32> this is a ... very specific error message :D
tyler569 has quit [Remote host closed the connection]
ltriant_ has joined #zig
ltriant has quit [Ping timeout: 265 seconds]
protty has quit [Remote host closed the connection]
<pixelherodev> Is WASM supported at the moment? If so, is there a way to compile to WASM w/o graphics and have an in-browser "terminal?"
<pixelherodev> Right, thanks :)
mikdusan1 has joined #zig