ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
redj has joined #zig
redj_ has quit [Ping timeout: 256 seconds]
donlzx has joined #zig
quc has quit [Ping timeout: 244 seconds]
mahmudov has quit [Remote host closed the connection]
donlzx has quit [Quit: Leaving]
darithorn has quit [Quit: Leaving]
darithorn has joined #zig
v1zix has joined #zig
donlzx has joined #zig
v1zix has quit [Ping timeout: 252 seconds]
xtreak has joined #zig
dbandstra has joined #zig
very-mediocre has joined #zig
darithorn has quit [Quit: Leaving]
xtreak has quit [Remote host closed the connection]
xtreak has joined #zig
renatorabelo has quit [Read error: Connection reset by peer]
zolk3ri has joined #zig
sneow has quit [Ping timeout: 252 seconds]
xtreak_ has joined #zig
xtreak has quit [Ping timeout: 244 seconds]
bheads__ has quit [Ping timeout: 268 seconds]
xtreak_ has quit [Ping timeout: 268 seconds]
Richard10 has joined #zig
Richard10 has quit [Client Quit]
bheads has joined #zig
dbandstra has quit [Quit: Leaving]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
quc has joined #zig
unique_id has quit [Quit: Konversation terminated!]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
donlzx has quit [Remote host closed the connection]
very-mediocre has quit [Ping timeout: 252 seconds]
very-mediocre has joined #zig
<andrewrk> this was the answer to the puzzle at the end of the stream yesterday: https://clbin.com/jrDm2
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
wilsonk_ has joined #zig
wilsonk has quit [Read error: Connection reset by peer]
davr0s has joined #zig
Bas_ has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<GitHub55> [zig] andrewrk pushed 1 new commit to master: https://git.io/fNqiD
<GitHub55> zig/master 5354d1f Andrew Kelley: allow == for comparing optional pointers...
Ichorio has joined #zig
wilsonk_ has quit []
<Bas_> Did you ever think about being able to do a for loop over multiple slices and stuff?
<Bas_> like
<Bas_> for (array1, array2) |value1, value2| {
<Bas_> etc.
<andrewrk> I think a userland solution for that is reasonable
<andrewrk> var it = chain(array1, array2); while (it.next()) |value1| { ... }
<andrewrk> oh your example is for simultaneous iteration
<andrewrk> for (array1) |value1, i| { const value2 = array2[i]; ... }
<andrewrk> I think this is reasonable
wilsonk has joined #zig
xtreak has joined #zig
davr0s has joined #zig
unique_id has joined #zig
<unique_id> Is "_ = foo();" how you avoid return values?
<andrewrk> yes, that's how you discard return values at the callsite
<winksaville> andrewrk, have u looked into bug 1225 I reported yesterday, if not I'd like to look into it to try to learn about the compiler?
<andrewrk> I have not yet - go for it
<andrewrk> happy to answer questions
<winksaville> txs
<Bas_> Yeah that's what I did for now. It's ok.
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…]
<GitHub140> [zig] andrewrk pushed 2 new commits to master: https://git.io/fNqQe
<GitHub140> zig/master 171f33b Andrew Kelley: ir: remove unnecessary and probably buggy code
<GitHub140> zig/master 860d3da Andrew Kelley: ir: remove dead code
zolk3ri has quit [Ping timeout: 260 seconds]
zolk3ri has joined #zig
xtreak has quit [Ping timeout: 268 seconds]
<winksaville> andrewrk, regarding bug 1225, I was wrong, the compiler isn't crashing its the program. The only question is should the compiler have caught my error?
<andrewrk> winksaville, I think @errorName should not allow an error!void argument
<andrewrk> so this would be a compile error
<winksaville> SG, I'll update the bug.
<andrewrk> this is probably a remnant from when we used to have `error.Ok`, which is now an anti-pattern
isd has joined #zig
<GitHub197> [zig] andrewrk pushed 1 new commit to master: https://git.io/fNqFu
<GitHub197> zig/master c87102c Andrew Kelley: ir_get_ref: delete unnecessary and probably buggy code
<winksaville> andrewrk, I've taken a quick look and I see that @errorName is added to Codegen::builtin_fn_table in src/codegen.cpp but there is only param_count and no type information.
<andrewrk> winksaville, here's a clue: ir.cpp:16187
<andrewrk> woah wtf it implicit casts to its own type?
davr0s has joined #zig
<andrewrk> that's a mistake. it should be implicit casting to ira->codegen->builtin_types.entry_global_error_set
<andrewrk> I believe that should solve the problem. that + a new test case at the top of test/compile_errors.zig
<winksaville> hmm, 16187 is in ir_analyze_instruction_compile_err which seems to imply its already found an error, or is my source old?
<andrewrk> ir.cpp:16187 in c87102c304
<winksaville> k, I need to update I'm acient from yesterday :)
<winksaville> now 16187 is: static TypeTableEntry *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstructionErrName *instruction) {
<andrewrk> yep that is the clue
<andrewrk> this line is wrong: IrInstruction *casted_value = ir_implicit_cast(ira, value, value->value.type);
<winksaville> ok, so first off type information is code not data?
<andrewrk> I don't understand the question
<andrewrk> the IR code deals in values, which have types
<andrewrk> the parameter to @errorName is a value, which has a type
<Bas_> wew
<Bas_> ArrayList is broken.
<Bas_> I'll... have to figure out how to do a pull request I guess.
<winksaville> I was expecting type info "data" to be created when create_builtin_fn was called, but just my bias, np.
<andrewrk> Bas_, uh oh. what's the synopsis?
<Bas_> insert does the copy wrong
<andrewrk> what, we have ArrayList.insert?
<Bas_> yes
<Bas_> line 84
<andrewrk> oh look at that
<MajorLag2> and insertSlice
<andrewrk> oh, it's using, essentially, memcpy where the slices are not allowed to overlap
<andrewrk> this problem
<Bas_> Yeah and I see the insertSlice is just as broken
<andrewrk> this is related to https://github.com/ziglang/zig/issues/1108
<andrewrk> idea being that we would have some kind of runtime safety notice that the slice parameters overlapped
<andrewrk> so at least the bug would have been easier to track down
<Bas_> It's fairly easy to check.
<andrewrk> https://github.com/ziglang/zig/issues/382 "std.mem.copy does not work if slices overlap"
<winksaville> Is there debug logging support in the compiler?
<Bas_> The thing is... memcpy does work if the slices overlap, as long as the source is larger than the destination. ^^
<Bas_> although I think you're supposed to use memmove.
<winksaville> yes, memmove on overlaped data
<winksaville> txs
<winksaville> that's adding logging to the .zig sources, correct. I want to add logging to .cpp code and print contents of structures.
<andrewrk> I've been using gdb breakpoints for that
mahmudov has joined #zig
<andrewrk> there's always fprintf
very-mediocre has quit [Quit: Page closed]
<winksaville> my gdb skills are minimal so not what I turn to first, but maybe I need to up my game there. Also, I added some fprintf to ir_analyze_instruction_err_name and see that its called 5 times, so I need to educate myself on the compiler flow to get my bearings. Any docs on the internals?
<andrewrk> nope
<winksaville> k
<winksaville> Is there a .cpp style guide and maybe a vi ftplugin you use?
<andrewrk> there is no style guide, and I use the default vim cpp ft plugin
<winksaville> sg
<Bas_> ok, I have a question
<Bas_> Is the realloc on an allocator supposed to keep the data intact or does it just return an undefined slice of memory?
<andrewrk> it keeps the data intact
<andrewrk> if you're looking at the implementation of std.mem.Allocator, it sets the new bytes to undefined
<Bas_> ok, cause that's not what the documentation says.
<andrewrk> this allows the compiler to set the bytes to 0xaa in debug mode
<andrewrk> where are you looking?
<Bas_> reallocFn
<Bas_> line 26
<andrewrk> I agree that is unclear. "newly allocated memory" is intended to mean the new bytes, not the old bytes that are preserved. I'll clarify
<Bas_> Ah ok
<Bas_> So the implementation is supposed to do the copy if nessecary?
<andrewrk> correct
<Bas_> Yeah I guess there's no other option. And if you don't need that behaviour you can just do free and alloc.
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<andrewrk> Bas_, how's this? https://clbin.com/0oTo8
<Bas_> Yeah, that's clear.
davr0s has joined #zig
<GitHub90> [zig] BarabasGitHub opened pull request #1232: Fix array list insert (master...fix-array-list-insert) https://git.io/fNmJj
Ichorio has quit [Ping timeout: 248 seconds]
<GitHub174> [zig] BarabasGitHub opened pull request #1233: Replace loop in ensureCapacity with a std.mem.max for the new capacity. (master...remove-weird-loop-in-array-list) https://git.io/fNmUj
iso_ has joined #zig
jitsudo has quit [Read error: Connection reset by peer]
Bas_ has quit [Ping timeout: 252 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<GitHub169> [zig] eduardosm opened pull request #1234: codegen: Store returned value if type is 'handle_is_ptr' and function… (master...extern-return-small-struct) https://git.io/fNmYu
donlzx has joined #zig
donzx has joined #zig
donlzx has quit [Client Quit]
isd has quit [Quit: Leaving.]