ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
steveno_ has joined #zig
steveno has quit [Ping timeout: 260 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
steveno_ has quit [Quit: Leaving]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
tolitius has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tolitius has quit [Ping timeout: 240 seconds]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
<Summertime> so there is a while loop that can handle null output, and one that can handle error output, but there isn't a way to easily handle output which can be nullable and can throw an error?
<andrewrk> Summertime, correct - not at the same time
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<andrewrk> if and while support the same syntax with regards to optionals and error unions
<andrewrk> so you will probably have an outer while loop and an inner if
davr0s has joined #zig
m4ge123 has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Summertime> https://github.com/Summertime/posix-implementations/blob/master/pozig/src/echo.zig how's my driving? (other than me using a woefully out of date version)
<Summertime> one thing that's kinda eating at me, is I've got multiple calls to stdout.write which can error, in slightly different scopes, `try` will push it up scopes, but how do I handle it before it hits main?
<andrewrk> Summertime, is this posix-only code? you might want to use args.nextPosix() instead of args.next()
<andrewrk> the posix only API does not require an allocator and cannot fail
<andrewrk> have a look at using `if` and `catch` with errors
<Summertime> m, still not quite putting it together mentally, like, I know I can catch on each write, I know I can use if to conditionally run code if its an noterror/error, but I'm not too sure what is the zigish? approach with this code, in other languages it'd be a trycatch, in zig, do I wrap the code in a function instead?
<Summertime> I think I could just really muck around with the panic handler and call it a day, but that seems a bit hackish
<andrewrk> are you looking to avoid `try` in main? if so why?
<andrewrk> or rather, a better question - what are you trying to accomplish?
<Summertime> if there is an error writing to stdout, I want at most the application to give an non-zero exit, and have zero output on stderr
<Summertime> I don't mind try in main, but I just want it to say and act exactly how I want if an error happens... I guess panic handler is the answer then?
<Summertime> oh, panic handler doesn't go if errors are returned from main?
<andrewrk> Summertime, that will happen in a release-fast build
<andrewrk> in release-fast returning an error from main just does exit(1)
<andrewrk> ok my mistake - actually in release-fast mode it prints error: Foo
<andrewrk> if you want it to print nothing and do exit(1), I don't think you need to mess with the panic handler. I think you just want to have main do: main2() catch |err| exit(1)
<andrewrk> or, make the return value of main u8, and then `main2() catch return 1`
<Summertime> easy enough, thanks for the guidance!
<Summertime> https://github.com/ziglang/zig/issues/1048 I guess anonymous functions would probably make such a pattern easier too
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
return0e_ has joined #zig
return0e has quit [Ping timeout: 245 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<presiden> is there similar function like warn, but for stdout?
<presiden> something similar to printf?
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
jfo has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
steveno has joined #zig
Hejsil has joined #zig
<presiden> Hejsil: owh, I see
<presiden> Is the std documentation out there somewhere?
porky11 has joined #zig
<presiden> I see
jfo has quit [Ping timeout: 260 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Hejsil has quit [Quit: Page closed]
<andrewrk> MajorLag, have a look at https://ziglang.org/download/
MajorLag has quit [Read error: Connection reset by peer]
<andrewrk> the master branch stuff is auto-updated now
MajorLag has joined #zig
steveno_ has joined #zig
steveno has quit [Ping timeout: 250 seconds]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
porky11 has quit [Quit: Leaving]
tolitius has joined #zig
<wilsonk> @andrewrk Thanks for the dark theme for the ziglang documentation!!! :). SOOOO much more readable and easy on the eyes!
davr0s has joined #zig
<andrewrk> wilsonk, you're welcome
Jenz has joined #zig
<Jenz> I want to read the contents of a file into a var. In github:ziglang/zig/examples/cat the program uses a buffer, [1024 * 5]u8, but how do I do it if I want variable length?
<andrewrk> Jenz, perhaps do you want std.io.readFileAlloc?
<andrewrk> this API is missing a parameter to set a maximum allowed file size - so be sure to use it only if the length of the file is not user input.
* Jenz :D
<Jenz> Thanks a ton andrewrk!
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
Jenz has left #zig [#zig]
steveno_ has quit [Remote host closed the connection]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
tolitius has quit [Quit: zzz...]
pqflx3[m] has joined #zig