ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<andrewrk> dbandstra2, the issue that intends to address this in a big way is well-defined copy elision
<andrewrk> I think the proposal is stale, but bottom line is that your gist would actually work correctly
<dbandstra2> what defines whether a value is considered copyable/non-copyable?
<dbandstra2> currently you can return any struct... if in the future some structs (but not others) get the elision, or, some structs work and some cause a compile error, what is the criteria ? would the user write some explicit keyword in the struct definition?
davr0s has joined #zig
dbandstra2 has quit [Quit: Page closed]
dbandstra has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<GitHub77> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhR24
<GitHub77> zig/master bbb565a Andrew Kelley: README: update support table...
kristate has quit [Remote host closed the connection]
kristate has joined #zig
<MajorLag1> andrewrk, is there an issue for annotations?
<andrewrk> MajorLag1, annotations of C code before translation? or of struct fields?
kristate has quit [Ping timeout: 264 seconds]
<MajorLag1> struct fields, or possibly other things too.
cenomla has joined #zig
<andrewrk> dbandstra, I don't have the answer to that stuff off the top of my head. I'll need to re-think that whole issue when I get back to it
<andrewrk> MajorLag1, I don't think anyone created that proposal yet. would you like to do it?
<MajorLag1> I might do it tomorrow. I ran into a case where I'd liked to have used it, so I'm probably in the frame of mind to articulate an argument for it.
<dbandstra> andrewrk, no problem. hopefully as i get better immersed in the language i can be more constructive
IntoxicatedHippo has joined #zig
IntoxicatedHippo has quit [Quit: Leaving]
IntoxicatedHippo has joined #zig
<IntoxicatedHippo> How would you design an API for a library that parses json directly in to structs? Possibly involving nested structs and arrays.
<IntoxicatedHippo> I have a way of doing it in C but it's quite verbose and there's no way to check if it's valid https://gist.github.com/liampwll/fde28265753ecb55601c43e9c5f37513
<andrewrk> IntoxicatedHippo, I know that tiehuis intended this API to be a low level json parsing API that you could build a reflection-based API on top of: https://github.com/ziglang/zig/blob/bbb565a21e40f305b9fa10c385124455fafe647f/std/json.zig#L84-L89
<andrewrk> now that we have @typeInfo and @field I think it should be fairly straightforward
<andrewrk> and potentially related to MajorLag1's upcoming proposal
<GitHub58> [zig] andrewrk pushed 2 new commits to master: https://git.io/vhRw9
<GitHub58> zig/master bd13e75 Andrew Kelley: disable deref syntax for unknown length pointers...
<GitHub58> zig/master 0ccc186 Andrew Kelley: disable field access for unknown length pointers...
cenomla has quit [Quit: cenomla]
cenomla has joined #zig
kristate has joined #zig
IntoxicatedHippo has quit [Quit: Leaving]
cenomla has quit [Quit: cenomla]
darithorn has quit [Quit: Leaving]
<GitHub94> [zig] andrewrk pushed 2 new commits to master: https://git.io/vhRKc
<GitHub94> zig/master d3693dc Andrew Kelley: Pointer Reform: update @typeInfo...
<GitHub94> zig/master 76c8efd Andrew Kelley: add test for not allowing implicit cast from T to [*]const T...
defragger has joined #zig
quc has joined #zig
isd has joined #zig
kristate has quit [Remote host closed the connection]
metrop has joined #zig
metrop has quit [Quit: Page closed]
dbandstra has quit [Quit: Leaving]
kristate has joined #zig
isd has quit [Quit: Leaving.]
<GitHub20> [zig] tiehuis opened pull request #1062: Add json.TokenStream (master...json-changes) https://git.io/vhRDU
tiehuis has joined #zig
<tiehuis> IntoxicatedHippo: I was thinking something simple like this https://clbin.com/whFYk
<tiehuis> one more thing i didn't write there, but we could add json.Value as a field and delay parsing or allow parsing dynamic multi-typed arrays via that
<tiehuis> otherwise, i'd just start of simple and handle the common cases first, omitting the more complex ideas mentioned
tiehuis has quit [Client Quit]
jjido has joined #zig
SimonNa has quit [Remote host closed the connection]
SimonNa has joined #zig
jjido has quit [Ping timeout: 264 seconds]
davr0s has joined #zig
<kristate> Trying to flush-out async IO. Posted a comment here: https://github.com/ziglang/zig/issues/938#issuecomment-394981967
<kristate> I wonder if we should tie scheduler functionality to allocators
<kristate> Here is a simple test harness for #938 https://github.com/kristate/zig-fix-938
kristate has quit [Ping timeout: 276 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
noonien has joined #zig
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…]
<GitHub175> [zig] tiehuis pushed 1 new commit to master: https://git.io/vh0vD
<GitHub175> zig/master 212449b Marc Tiehuis: Fix Log2Int type construction...
davr0s has joined #zig
<Hejsil> Why is it not possible to export function that take/return pointers to Zig auto layout structs?
clownpriest has joined #zig
SimonNa has quit [Quit: Leaving]
<MajorLag1> Does anyone know, is there a reasoning behind forcing input buffers to be exactly equal to @sizeOf(T) when converting between bytes and types, instead of >= ? For instance: std.mem.readIntBE
rkeene has left #zig [#zig]
kristate has joined #zig
<GitHub138> [zig] BraedonWooding opened pull request #1064: Add newline to zig fmt error (master...patch-4) https://git.io/vh0Eb
bheads_ has joined #zig
<clownpriest> working on a strings library. still super early, but hope is to cover a very large area of functionality
<clownpriest> i've only just started learning zig, so i'd imagine it's not the best code, but it compiles and runs
bheads__ has quit [Ping timeout: 240 seconds]
quc has quit [Ping timeout: 265 seconds]
<andrewrk> clownpriest, neat!
<GitHub75> [zig] andrewrk closed pull request #1064: Add newline to zig fmt error (master...patch-4) https://git.io/vh0Eb
<GitHub10> [zig] andrewrk pushed 1 new commit to master: https://git.io/vh0z4
<GitHub10> zig/master f389e53 Braedon: Add newline to zig fmt error (#1064)
Hejsil_ has joined #zig
<andrewrk> MajorLag1, that can be up for discussion. I reasoned that if the number didn't match exactly, it was probably a mistake
<andrewrk> I'd be curious to see an example where that is not the case
<andrewrk> kristate, why not have ChildProcess.exec start the event loop (scheduler) and use it, and then deinitialize it before returning?
<kristate> andrewrk: Thanks for the reply/followup. (i) there could be a loop already running inside of the thread/instance and (ii) starting a new scheduler could be expensive
<kristate> also, waiting on one scheduler while another is already running is the same as blocking
<andrewrk> kristate, we'll definitely want to have a non-blocking API for child processes where you can use an already existing event loop
<andrewrk> the blocking API might simply create an event loop and then call down to this one
<kristate> andrewrk: that's why I thought it might be cool to piggy-back on the allocator since it seems to be tied to async already
<andrewrk> can you elaborate? I don't see allocators as being tied to async
<andrewrk> I would agree the other way around - async depends on allocators
<kristate> andrewrk: that is my understanding, async depends on allocators
quc has joined #zig
<andrewrk> right, to create a coroutine requires an allocator
<kristate> so when the coro is allocated, it could also register with an event loop that might be tied to the allocator
<andrewrk> here's the thing though: coroutines as a language feature currently do not require an event loop
<andrewrk> and an event loop can be created entirely in userland
<andrewrk> wait, are you suggesting a userland change or a language change?
<kristate> thanks for the good questions, I think more or less stdlib. I come from a C background and don't want to force loops on anyone. But, stdlib needs a loop
<andrewrk> did you see std.event.Loop ?
<kristate> I think the closest thing would be what apple did with objective-c, and possibly swift (but I haven't looked at swift)
<kristate> yes, but there is no infra to get a global loop
<andrewrk> but you can pass a loop as a parameter to anything that needs one
Ichorio has joined #zig
<andrewrk> the same as if you are using libuv in C
<kristate> I think that might be too much -- we already pass in the allocator
<andrewrk> the event loop has an allocator field
<andrewrk> so if you need an allocator and an event loop, you can accept only an event loop
<kristate> right, could be possible to do a parent-whatever-you call it to get a pointer to the parent struct
<kristate> but, in the case that such an allocator was not encased into an event struct, then what would happen? compiler error?
<andrewrk> I'm saying that if you have a *Loop you can get a *Allocator by doing loop.allocator
<kristate> how do you know that you're in a loop from an async function?
Hejsil_ has quit [Ping timeout: 260 seconds]
<andrewrk> if you need access to an event loop then you can make it be available from the parameters you pass
<andrewrk> the async functions above actually don't need access to the event loop, but they would if they wanted to do other non-blocking stuff like networking or child process interaction
<kristate> stdlib is really tough to make async without some sort of trait for event loops and then also finding that event loop
<MajorLag1> andrewrk, I'm using it those functions to read/write struct fields from a file, in which case it is convenient to just pass `buffer[offset..]`. It isn't a big deal, I was curious because I'm looking at making a PR for some tweaks to std.mem and std.io to match their readInt/writeInt APIs, and fix an issue with writeInt not working on single bytes, and I was considering changing that assert.
<kristate> Apple provides a runloop per thread by default: https://developer.apple.com/documentation/foundation/runloop
<andrewrk> the next thing I want to explore is multiplexing kernel threads onto coroutines
<andrewrk> that would be a single runloop
<kristate> andrewrk: generally, when is a good time for you? I am in Japan (GMT+9) and it's currently 0:21am
<andrewrk> my day started 2 hours ago (GMT-5)
<kristate> Cool -- is Zig full time for you at the moment?
<andrewrk> it will be starting friday
<kristate> awesome
<andrewrk> I'm planning on making an announcement blog post to try to gain some momentum
<kristate> As much as I have gotten into Rust, I still like programming C. With Zig, I really like how a lot of the power of LLVM is exposed in the builtins
<GitHub190> [zig] andrewrk closed pull request #1062: Add json.TokenStream (master...json-changes) https://git.io/vhRDU
<GitHub42> [zig] andrewrk pushed 1 new commit to master: https://git.io/vh0r9
<GitHub42> zig/master e7f141b Marc Tiehuis: Add json.TokenStream (#1062)...
Ichorio_ has joined #zig
Ichorio has quit [Ping timeout: 264 seconds]
<kristate> andrewrk: is this proposal still valid? https://github.com/ziglang/zig/issues/727#issuecomment-366856402
Jezza__ has joined #zig
<andrewrk> kristate, I deviated a little from that proposal in the implementation and I have yet to document it
<kristate> okay, I like how the event loop is included
Ichorio_ has quit [Ping timeout: 265 seconds]
<kristate> If we can agree on an interface/trait for loops and async i/o, I can start to rework some of stdlib
<kristate> I really want to get networking up
<andrewrk> I agree it's a high priority issue
<kristate> andrewrk: what would be a good way to setup a global variable for the run loop? pub var? https://github.com/ziglang/zig/blob/652f4bdf6242462182005f4c7149f13beaaa3259/std/os/index.zig#L199
<andrewrk> yes, if a global variable is the right path
<andrewrk> I think that we can make progress in the std lib even if we have to refactor it later
<andrewrk> we can get networking going and then figure out how to restructure it
<kristate> If you have time, it would be great to get a table outlining how much stdlib is complete -- that is, which parts are set in stone, and which parts are WIP
<kristate> personally, I am thinking abou
<andrewrk> good idea
<andrewrk> in general, until 1.0.0 everything can potentially be changed
<kristate> personally, I am thinking about taking the best of std and starting over
<andrewrk> we have no stability yet
<kristate> I like how there is no reliance on libc
<andrewrk> std largely exists as a way to test out the language, until the language is stable
<kristate> and I see that you have lots of syscalls
<nc-x[m]> How will I go about converting [1]u8 to []u8 ?
<andrewrk> nc-x[m], array[0..]
<nc-x[m]> Sorry my question was vague. How do I convert "abc" to []u8 directly in a function call. Using the above syntax I get a []const u8 :(
<nc-x[m]> To workaround, I am currently first saving it to a variable and then converting it
<andrewrk> nc-x[m], in zig you have to always be able to answer the question, "where is the memory?"
<andrewrk> the answer for string literals is, it's in the global constant .data section
<andrewrk> you cannot mutate string literals, so taking a reference to them gives you a []const u8
<andrewrk> if you want a mutable slice, you have to answer the question of "where is the memory?"
<nc-x[m]> So I have to always first save them in a variable before converting them? No other workaround?
<andrewrk> if you save an array in a local variable of a function, you are answering the question with "the memory will be in the stack frame of this function". if that answer is acceptable then that is the best place to put the memory
<andrewrk> another place is globally, if that makes sense. otherwise you will have to heap-allocate and then be sure to free the memory when done
kristate has quit [Remote host closed the connection]
kristate has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
<GitHub105> [zig] isaachier opened pull request #1065: Fix const-ness of buffer in replaceContents method (master...const-buffer-replace-fix) https://git.io/vh0dS
noonien has quit [Quit: Connection closed for inactivity]
Dodo has joined #zig
<Dodo> hi!
btbytes has joined #zig
<Dodo> can I use const Iterators yet? ;p
<andrewrk> Dodo, what do you mean?
<GitHub172> [zig] andrewrk closed pull request #1065: Fix const-ness of buffer in replaceContents method (master...const-buffer-replace-fix) https://git.io/vh0dS
<GitHub122> [zig] andrewrk pushed 1 new commit to master: https://git.io/vh0NT
<GitHub122> zig/master 4fc6018 isaachier: Fix const-ness of buffer in replaceContents method (#1065)
<Dodo> https://github.com/DutchGhost/Zigerator/blob/master/src/main.zig#L19 <--- this does not work with comptime yet, and currently it can't work with comptime
<Dodo> in the file "Iterator.zig", there is this one line on line 88... "self.data.small_buffer.flag_byte = 1;"
isd has joined #zig
<GitHub193> [zig] andrewrk opened pull request #1066: fix std.os.windows.PathFileExists specified in the wrong DLL (master...windows-path-file-exists) https://git.io/vh0A9
kristate has quit [Remote host closed the connection]
kristate has joined #zig
kristate has quit [Remote host closed the connection]
kristate has joined #zig
<GitHub98> [zig] andrewrk closed pull request #1066: fix std.os.windows.PathFileExists specified in the wrong DLL (master...windows-path-file-exists) https://git.io/vh0A9
<GitHub65> zig/master b11c5d8 Andrew Kelley: fix std.os.windows.PathFileExists specified in the wrong DLL (#1066)...
<GitHub65> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhEeN
jjido has joined #zig
dbandstra2 has joined #zig
jjido has quit [Ping timeout: 264 seconds]
dbandstra2 has quit [Quit: Page closed]
kristate has quit [Ping timeout: 276 seconds]
Dodo has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
clownpriest has quit [Quit: Textual IRC Client: www.textualapp.com]
isd has quit [Quit: Leaving.]
btbytes has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Jezza__ has quit [Ping timeout: 248 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
clownpriest has joined #zig
quc has quit [Ping timeout: 260 seconds]
isd has joined #zig
JinShil has joined #zig
<clownpriest> are there any built in benchmarking functions/tools yet?