ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
Ichorio has quit [Ping timeout: 268 seconds]
relatingdata has joined #zig
Braedon has joined #zig
stephaneyfx has left #zig ["Leaving"]
isd has quit [Quit: Leaving.]
<GitHub82> [zig] andrewrk pushed 1 new commit to master: https://git.io/vxdmb
<GitHub82> zig/master 4545be3 Andrew Kelley: fix std.io.readline to work on windows...
Braedon has quit [Ping timeout: 260 seconds]
<relatingdata> reading documentation: is there a "do" - "while" in zig like "repeat" - "until" ? the for loop looks like a map over an array or range in languages like lisp/scheme/javascript ?
<achambe> andrewrk: was thinking about your http demo after reading some ipfs issues regarding unbounded memory growth. The explicit allocators in zig let you do some cool thing around upper memory limits on servers.
<achambe> max_concurrent_requests * max_memory_per_request = stable server
<achambe> really need to pick a small scale project to do in zig
<achambe> oh, comptime sqlite bindings would be cool too
<achambe> so many things :D
isd has joined #zig
isd has quit [Remote host closed the connection]
relatingdata has quit [Quit: Page closed]
Tobba_ has joined #zig
Tobba has quit [Ping timeout: 255 seconds]
<heakins> What's the most concise way to perform a loop n times?
<heakins> I guess it's "var i: usize = 0; while(i < n) : (i+=1) {...}"
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Client Quit]
davr0s has joined #zig
davr0s has quit [Client Quit]
kammd[m] has quit [*.net *.split]
davr0s has joined #zig
kammd[m] has joined #zig
arBmind has joined #zig
<MajorLag> I think I have nested comptime too deeply. A comptime struct initializer inside a comptime type generator inside a comptime type generator doesn't recognize itself as a valid return type.
<MajorLag> and @typeOf(this) as a substitute crashes.
<MajorLag> I can probably work around this with some refactoring, which I have to do anyway because the first pass way of doing things caused it to depend on itself anyway, messing up the entire API.
<MajorLag> for instance making things like this necessary: [][]const u8{"rotation"[0..]})[0..]
alexnask has joined #zig
hopppetosse has joined #zig
<alexnask> Is there any way to get a slice of the types of a vararg parameter at comptime?
<hopppetosse> alexnask: could you use @typeOf(args[n]) to get each individual type and build an array out of that?
<alexnask> Good point :P I wanted to use it to pass them to a return type function, e.g. a make_tuple function that would take varargs and return a Tuple([]type) from the varargs
<alexnask> I guess I could just use an intermediate function
<alexnask> Not sure, I'll give it a go
jzelinskie has quit [Quit: ~]
jzelinskie has joined #zig
l1x has quit [Quit: ~]
l1x has joined #zig
monteslu has quit [Quit: ~]
monteslu has joined #zig
<commander> file:///run/media/commander/USB DISK/Zertifikat_SUAF_2016.docx
<commander> file:///run/media/commander/USB DISK/Zertifikat_SUAF_2017.docx
<commander> oops :D
<commander> sorry about that
ragge has quit [Quit: ~]
ragge has joined #zig
arBmind has quit [Ping timeout: 240 seconds]
<GitHub19> [zig] andrewrk pushed 1 new commit to master: https://git.io/vxFCZ
<GitHub19> zig/master 477ded9 Andrew Kelley: add missing call in zig fmt to commit results to disk
hopppetosse has quit [Ping timeout: 265 seconds]
<andrewrk> MajorLag, I'll get to your PR today. sorry about the delay
hopppetosse has joined #zig
hopppetosse has quit [Ping timeout: 260 seconds]
<MajorLag> no rush, it's just a bunch of syscalls.
<MajorLag> huh, more weird windows Debug issues. This time it works in release-safe when it shouldn't and crashes debug when I expect a panic.
<andrewrk> I would focus on the crash in debug mode first
<MajorLag> well I know why it's crashing I guess, I'd hoped it wouldn't but the problem with accessing memory for a guard value is that the region you're trying to access may not actually be mapped. I guess that explains why it works under other seemingly random conditions too.
abique has joined #zig
abique has quit [Quit: abique]
<MajorLag> so I guess that whole saftey paradigm is flawed. I was hoping it would at least work for the stack.
Tobba_ has quit [Read error: Connection reset by peer]
noonien has joined #zig
SimonNa has joined #zig
<andrewrk> MajorLag, I still don't understand why your safety field doesn't work. because that field should be in a mapped page right?
<andrewrk> oh I'm looking at it again
<MajorLag> yeah, I'm not really certain how it is happening myself. Stack guards? If the interface gets separated from the parent, sometimes the stack happens to still have the parent there, other times it doesn't and something is catching that and throwing an OS exception.
<andrewrk> oh, yeah that makes sense
<MajorLag> but that seemingly random behavior doesn't make the pattern very useful, unfortunately.
Ichorio has joined #zig
isd has joined #zig
<andrewrk> I wonder if there's another way to accomplish this kind of runtime safety in debug mode, if we were willing to add in some kind of extra runtime
<MajorLag> Maybe, it looks like LLVM implements the stack guard protections? Maybe there's a way to hook in to that. On the heap you'd need to deal with SEH on Windows and catching SIGSEGV on Linux.
<andrewrk> MajorLag, I'm thinking something more language level
<andrewrk> for example: since we don't guarantee struct size: every struct could contain an extra field which is a boolean, whether it was initialized in stack memory. The `return` statement could generate code that makes sure that if we're returning a pointer to a struct, the struct is not stack allocated
<andrewrk> there are flaws in this example, but that's the kind of thing I'm thinking of
jacobdufault has quit [Quit: WeeChat 1.9.1]
<MajorLag> Hmm... couldn't you check the pointer at return to see that it isn't pointing to a stack frame that's about to disappear?
<andrewrk> that's a good idea
<andrewrk> I know we at least have ability to get the frame pointer. I wonder how to determine the end of the frame
<andrewrk> oh, we could call a noinline function that returns @frameaddress()
<andrewrk> that one thing could catch a lot of mistakes
<andrewrk> this is a great idea
<MajorLag> I think your proposal about enforced cleanup semantics might be relevant too. If I init(), and don't deinit() or say that I'm going to do it later, that would be a catch at compile time that I'm probably doing something wrong. I don't particularly like the extra keywords and related additions to fn definitions, but I can see how it'd be useful here.
<andrewrk> yeah, you'd mark a function as "caller must acknowledge cleanup responsibility"
hoppetosse has joined #zig
hopppetosse has joined #zig
hoppetosse has quit [Ping timeout: 240 seconds]
Ichorio has quit [Read error: Connection reset by peer]
Tobba has joined #zig
isd has quit [Quit: Leaving.]
alexnask has quit [Ping timeout: 260 seconds]
noonien has quit [Quit: Connection closed for inactivity]
hopppetosse has quit [Ping timeout: 240 seconds]
epsyloN has quit [Ping timeout: 240 seconds]
epsyloN has joined #zig
hopppetosse has joined #zig