ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
wootehfoot has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
emekoi has joined #zig
<emekoi> what is the purpose of lines like https://github.com/andrewrk/zig-window/blob/master/src/main.zig#L36? as it resumes itself in its suspend block it resumes itself, so isn't there no point in suspending?
<andrewrk> emekoi, it's a workaround for a coroutine bug that will be fixed with the rewrite
<emekoi> is there a way to get the handle of an async function without calling and suspending from inside it?
StateOff has joined #zig
<daurnimator> andrewrk: hey :)
<StateOff> Hi there.
IntoxicatedHippo has joined #zig
emekoi has quit [Quit: Page closed]
very-mediocre has joined #zig
tiehuis has joined #zig
wink_ has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
IntoxicatedHippo has quit [Ping timeout: 272 seconds]
benjikun has joined #zig
StateOff has quit [Quit: Leaving]
reductum has joined #zig
<reductum> Just starting to get acquainted with the stdlib. I would like to pass a *std.unicode.Utf8Iterator to a function, but that struct is private. Is there a reason for that?
<reductum> I ask because right below Utf8Iterator, Utf16LeIterator is defined, and that's public.
<andrewrk> reductum, generally, if something is private but seems like it should be public, it was an oversight
<reductum> andrewrk: Got it. I shall submit the most trivial of PRs.
<andrewrk> reductum, apologies, I already pushed to master
<reductum> Even better! Now I can pull it down and continue with this (zig) advent of code.
<andrewrk> wow you're doing unicode stuff?
<andrewrk> why is that?
<andrewrk> I ask because I just finished mine
<reductum> Well I'm taking this advent of code as an opportunity to familiarize myself with various bits of the stdlib, so I decided to treat the "input" for the first puzzle as utf8 code points, even though it's all the ascii subset.
<andrewrk> interesting
<andrewrk> that goes against something I've come to the conclusion of about utf8, which is that, the beauty of it is that you can almost always leave it encoded
<reductum> I've watched zig from afar for a while, but decided I should finally get used to actually programming with it.
<andrewrk> (can, and should)
<reductum> Yes that's the way I usually do it. I think I've drifted toward this approach due to unfamiliarity with the language and the stdlib. I guess I should poke around more.
<reductum> Yes. It was helpful to look at std/zig/tokenizer.zig
IntoxicatedHippo has joined #zig
bcdfgh has joined #zig
<bcdfgh> Are there plans for os.File to support io.readLineSliceFrom() ? I got an error readByte() not defined for os.File (IIRC).
<bcdfgh> Another thing regarding https://github.com/ziglang/zig/issues/1050#issuecomment-440533017. I agree with "Since it's only 1 character, and it's semantically equivalent". But I don't feel that it makes the language any smaller or bigger. It should be a relatively small change and AFAIK almost all languages with slices support it.
bcdfgh has quit [Quit: Page closed]
tiehuis has quit [Quit: WeeChat 2.3]
<daurnimator> andrewrk: oh? what did you do with unicode?
reductum has quit [Quit: WeeChat 2.3]
return0e_ has quit []
return0e has joined #zig
IntoxicatedHippo has quit [Remote host closed the connection]
IntoxicatedHippo has joined #zig
Hejsil has joined #zig
<Hejsil> bcdfgh, if you do const stream = &file.inStream().stream; then you get all these functions: https://github.com/ziglang/zig/blob/6f5e7ee09c9269cfcc454cde88960987054ee031/std/io.zig#L35-L199
forgot-password has joined #zig
<daurnimator> Hejsil: is that safe?
<daurnimator> I thought file.inStream() may return a struct-by-value. then .stream may have methods that use @fieldParentPointer or something.
<Hejsil> Im taking the adress of the stream so its ok, as Zig stores the result of file.inStream() in memory on for me
ft3 has joined #zig
<ft3> Hi
<ft3> How's networking in Zig?
<ft3> I tried looking through the std lib and only found net.zig and not much in it unfortunately
<ft3> Thanks a lot!
meheleventyone has joined #zig
very-mediocre has quit [Ping timeout: 256 seconds]
forgot-password has quit [Ping timeout: 268 seconds]
<daurnimator> ft3: essentially I would wait for #1778 before writing any networking code
meheleventyone has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 240 seconds]
wootehfoot has joined #zig
porky11 has joined #zig
ft3 has quit [Quit: Lost terminal]
hio has quit [Quit: Connection closed for inactivity]
very-mediocre has joined #zig
sjums has joined #zig
fsateler has quit [Ping timeout: 246 seconds]
fsateler has joined #zig
meheleventyone has joined #zig
meheleventyone has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 250 seconds]
<sjums> I need some professional help on why I'm getting a compile error so I can understand it and do it right! >.<
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
basro has joined #zig
<basro> hello, does zig target or have plans to target to webassembly in the future?
<j`ey> zig uses LLVM, so I guess it's possible
reductum has joined #zig
<andrewrk> basro, yes
<andrewrk> if you look at the readme, webassembly is Tier 4 support, which is not great. after llvm 8 comes out, it will be Tier 3, and we can work on making it 2 and then 1
<andrewrk> sjums, pass your input as a pointer, so that it as mutatable
<basro> andrewrk, so there's at least a plan to have it be tier 1 in the future?
<andrewrk> basro, yes
<basro> ok, very nice
<andrewrk> the main blocker right now is that LLVM 7 (current release) has it as an experimental target
<andrewrk> so it's not even guaranteed to be available
<andrewrk> but that is changed in trunk
<andrewrk> so zig 0.4.0 will have the wasm target guaranteed
<basro> do you have a rough estimate on how long that will take from now? just so I can remind myself to come back and check zig for this purpose in after such time passed
<andrewrk> basro, 0.4.0 is scheduled for March 15 2019
<andrewrk> it's coordinated to be 1 week after LLVM 8 is released, so if they have a delayed release, zig does too
<basro> ok, thanks andrewrk, I'll definitely be checking out zig with the goal of using it for wasm by then
<andrewrk> basro, great, see you then :)
Hejsil has quit [Quit: Page closed]
very-mediocre has quit [Quit: Page closed]
so has quit [Ping timeout: 246 seconds]
emekoi has joined #zig
<emekoi> i was working on added network to support for windows and i was wondering if functions like ntohl and friends.
<emekoi> i'm guessing no because we have functions like std.mem.endianSwapIfLe
so has joined #zig
<emekoi> do we have a memmove implementation anywhere
seedofonan has joined #zig
<seedofonan> Is zig.exe expected to crash with the dialog box "Windows will close the program ..." anytime it reports an error?
sjums has quit [Ping timeout: 256 seconds]
reductum has quit [Ping timeout: 268 seconds]
<seedofonan> how does one ask a question here? My first time...
<hryx> seedofonan: the compiler shouldn't ever crash, so if you see that, it's probably a bug
<hryx> what command were you running (e.g. `zig build-exe`)? Does the crash happen every time?
<hryx> I'm not too familiar with windows, so I'm not totally sure what that dialogue means
reductum has joined #zig
<seedofonan> I just downloaded zig-windows-x86_64-0.3.0.zip and unzipped it. Seems to crashes every time it reports an error w/ stacktrace. And the stacktrace never has words, is always like ???:?:?: 0x7ff7e6d6167f in ??? (???).
<hryx> Oh, as for those question marks, I believe stack traces were broken on windows until recently https://github.com/ziglang/zig/issues/1655
<hryx> I'm not sure why you'd be seeing that dialogue though. Maybe someone with more windows experience would know what details to ask you
suirad has quit [Ping timeout: 256 seconds]
<seedofonan> Now I just tried the last nightly. Stacktrace has words okay, but still crashes out. Also now working is "zig build" following a "zig init-exe". That was also crashing with the 3.0 release version.
<benjikun> I'm pretty certain the question marks are intentional in some cases, gdb displays stuff similarly
<benjikun> Weird to see that windows dialog box popup though
<benjikun> seedofonan: What are you building?
<benjikun> I loaded up my windows laptop with 0.3.0
<seedofonan> Literally anything. Like in the top of the 0.3 release notes, there's a screenshot of "test "stack traces"" for "fn addOne" and then I do a "zig.exe test test.zig".
suirad has joined #zig
<suirad> seedofonan: what version of windows are you running?
<andrewrk> seedofonan, that's what windows does when a program crashes. that's expected behavior
<andrewrk> if you have a debugger installed it would open it up for you to debug
<andrewrk> seedofonan, we had an unfortunate regression with stack traces that happened right before 0.3.0 was released
<hryx> just so I understand, you mean this dialogue should appear any time something exits non-zero? Or crash as in get e.g. segfault?
<andrewrk> exit(1) should not trigger the pop up, but crashing with @panic or a segfault yes
<andrewrk> it's configurable in windows how windows should respond to this
<hryx> I see. what does @panic do that would make this happen?
<hryx> some kind of signal?
<andrewrk> in debug mode it's an actual trap instruction, intentionally, to trigger a debugger
<andrewrk> in release mode it's just exit(3)
<hryx> awesome, I see
<andrewrk> this is std.os.abort(). @panic calls the panic handler, which you can override in your root source file, but the default is here: https://github.com/ziglang/zig/blob/6f5e7ee09c9269cfcc454cde88960987054ee031/std/special/panic.zig#L9
<andrewrk> the default panic handler dumps a stack trace and then calls abort()
<andrewrk> seedofonan, if you have a suggestion for different behavior, please do share. this was the best I came up with when I looked at the APIs and experimented with different behaviors
<seedofonan> Okay, thanks all for your attention. The behavior is supprising for an operation like "zig build ...", but rational for zig, I imagine. And as you mention, configurable in Windows.
<andrewrk> seedofonan, I think there could be a good argument that `zig build` should not abort() when the build fails. That should probably be a normal exit(1)
<andrewrk> we have reached GitHub's popularity requirements for them to add zig syntax highlighting
<andrewrk> Happy December everyone
<hryx> oh hell yes
wootehfoot has quit [Read error: Connection reset by peer]
<suirad> awesome
<reductum> Yes!!
<suirad> that sort of recognition will add credibility to the name
Hejsil has joined #zig
<Hejsil> The repo list is on the liguest issue is cool. I should go through as see if people have made something cool
<Hejsil> Also 17 zig repos with nearly a 100 zig files from me!
<andrewrk> Hejsil, I enjoyed reading your advent of code code
<andrewrk> I see you bothered to handle stdin :)
<Hejsil> I was considering whether to just have an int array, a long string
<andrewrk> did you see mine?
<Hejsil> But then decided that those where boring and just did the stdin
<Hejsil> Ye
<andrewrk> haha
<andrewrk> I think my hashing strategy for AutoHashMap isn't amazing
<Hejsil> I'm using them a lot in my randomizer refactor: https://github.com/TM35-Metronome
<Hejsil> So hopefully there good enough
<andrewrk> the point is that they're good enough in theory, so we can always improve the implementation and not change the API
<Hejsil> Indeed
<Hejsil> Also, did a demo: https://youtu.be/4NwW_3MtlnQ
<andrewrk> oh cool!
<Hejsil> I'm really happy with how this is turning out. Idk if anyone cares for terminal based rom hacking though :)
<andrewrk> this is exciting, I haven't seen any demos from you until this one
<benjikun> This is in zig?
<benjikun> very cool hejsil :p
<Hejsil> Yes
<seedofonan> andrewrk, I don't have any opinion yet about zig build doing a panic vs an exit. Since the zig build system is compiling and running a user written zig application, perhaps that's why the present behavior makes good sense. More helpful I think would be a few words in the Documentaion at the beginning to set the expectation.
<andrewrk> Hejsil, I like this unix philosophy thing you have going here. it makes a lot of sense for this use case
<suirad> Hejsil: thats pretty cool
<emekoi> if github is going to add syntax highlighting support then we better make sure that the syntax highlighting is working properly.
<andrewrk> emekoi, it's a little outdated, but I believe once it gets accepted, then we are in control of the repository, and changes roll out on a regular basis