ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<marijnfs> valgrind still complains a lot though, there might be more such issues
<marijnfs> nvm seems just valgrind freaking out about vulkan
marijnfs has quit [Ping timeout: 258 seconds]
Hejsil has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 248 seconds]
<marler8997_> I just build LLVM without the -DCMAKE_PREFX_PATH option... I think it's only necessary for clang/zig but not for LLVM. I'll remove it from the wiki so long as no one has any objections?
<mikdusan> marler8997_: you probably have llvm-config in your default path. but not all OS (like macOS) have that and need a way to locate LLVM
<marler8997_> you need to locate llvm when you're building llvm?
<mikdusan> ah sorry nvm, i see what you mean now
<andrewrk> marler8997_, please just leave it in - it's simpler to pass the argument for everything that is part of this "local root" path
<andrewrk> for example sometimes there is another dependency: https://github.com/ziglang/zig/wiki/Building-Static-Zig-on-macOS
<marler8997_> oh I already removed it. I removed as it was confusing for me. I was trying to figure out what libraries LLVM was looking for
<marler8997_> of course I can un-remove it
<marler8997_> but it still confuses me
<marler8997_> oh...so it could depend on zlib?
<andrewrk> think of it like this: we're creating a directory that is the prefix for everything we're about to build from source
<marler8997_> k, I'll revert my change
<andrewrk> you are correct that technically the first dependency doesn't need the parameter
Ichorio has quit [Ping timeout: 250 seconds]
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 245 seconds]
hio has quit [Quit: Connection closed for inactivity]
Hejsil has quit [Ping timeout: 256 seconds]
<marler8997_> found a way to loop through varargs
<marler8997_> I made a function that given a comptime_int, returns an array of comptime_int where each entry is it's own index
<marler8997_> then I just do an inline for loop through that "index array" of comptime_int
lunamn has quit [Quit: leaving]
curtisf has joined #zig
<marler8997_> my solution could use some improvement though
<marler8997_> here's the challenge, can you implemet this function? pub fn allocVarargs(comptime T: type, allocator: *std.mem.Allocator, args: ...) ![]T;
<marler8997_> I've got a solution but want to see if anyone has a better one
<marler8997_> the function allocVarargs returns an array of the given variadic args
<mikdusan> marler8997_: here's my naive solution: https://gist.github.com/mikdusan/8377573c5a1659f975d6a86cbaae0fa2
<marler8997_> shoot that works
<marler8997_> I couldn't figure out how to loop through a comptime index, thanks for this, it helps alot
<marler8997_> Here's my final solution:
<marler8997_> thanks again for your help
<mikdusan> no problemo
<marler8997_> maybe this is a candidate for inclusion in the standard library?
<mikdusan> varargs is changing. so i don't know re: std library
<marler8997_> yeah I figured, I was thinking that in any case this functionality would still be supported though
<marler8997_> but I don't know for sure since I don't know where it's going
<marler8997_> but I would think having a function to convert varags to an array would still be supported no matter what
<marler8997_> I'll make a PR so it can be discussed
<marler8997_> remove varargs meaning no more varargs?
<mikdusan> take with grain of salt i might have this understanding wrong but:
<mikdusan> `allocVarargs([]const u8, arena, "one", "two", "three")`
<marler8997_> it looks like the current plan is to remove varargs based on what I'm reading
<mikdusan> would become `allocVarargs([]const u8, arena, .{"one", "two", "three"})`
<marler8997_> the syntax looks weird though
<marler8997_> instead of warn("hello {} you are {} years old", name, args)
<marler8997_> it would be warn("hello {} you are {} years old", .{name, arg})
<mikdusan> yes that is my understanding
<marler8997_> but maybe it would look fine with some "getting use to"
<marler8997_> well thanks for the info, since the plan is to remove varargs I won't push a PR
<marler8997_> I see one advantage is it allows multiple varargs
<marler8997_> that's pretty cool
<marler8997_> at first glance it looks like a nice alternative to tuples
<marler8997_> I andrew say "No Tuples". I'm looking for the information on why that decision was made. I would love to see a place where we could see decisions made in the language and the reasons for them.
cyanmide has quit [Remote host closed the connection]
mikdusan has quit [Ping timeout: 248 seconds]
mikdusan has joined #zig
lunamn has joined #zig
<daurnimator> marler8997_: I'm not sure where it is on the issue tracker. but varargs can't be removed: they're part of the C ABI and hence required for interoperation with C.
<marler8997_> oh sure, I'm talking about zig's varargs
<emekankurumeh[m]> is there a way to force zig to output debug gdb-friendly debug info on windows?
<marler8997_> zig's varargs (currently used with the format function) is more like a tuple
<marler8997_> I just finished converting my first project to zig. Fun stuff: https://github.com/bettertools/git-extra
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 245 seconds]
curtisf has quit [Ping timeout: 256 seconds]
<gonz_> c, d & zig :D
<marler8997_> Never finished the C version :)
porky11 has joined #zig
marmotini_ has joined #zig
jjido has joined #zig
<gonz_> I really like D conceptually, but I feel like it's so big. How I ended up looking at zig was actually that I was looking at using D as a better C, but I feel like I found something that fit that much better out of the box.
<gonz_> Though, to be fair, I have no practical experience with D.
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has joined #zig
marijnfs has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cameris has joined #zig
marmotini_ has quit [Ping timeout: 245 seconds]
hio has joined #zig
Ichorio has joined #zig
avoidr has quit [Quit: leaving]
porky11 has quit [Read error: No route to host]
porky11 has joined #zig
gamester has quit [Remote host closed the connection]
Ichorio has quit [Ping timeout: 252 seconds]
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ichorio has joined #zig
<tralamazza> any idea why this crashes the compiler? https://zig.godbolt.org/z/ACOnoy
<tralamazza> trunk only, 0.4 works
<marler8997_> gonz_: I've written hundreds of thousands of lines of D code at this point. It's got some really cool features but also has a fair amount of issues. I've written my own standard library in D to combat some of those issues https://github.com/marler8997/mar but there are also issues in the language. It's also very static now, any changes to the language must go through a multi-year proposal process, a process which is broken (I've
<marler8997_> had one that's about 3 years old and still going). The creator Walter is pretty set in his ways, he's very poor at maintaining a positive community and almost impossible to discuss language ideas with. He knows alot, but seems to only value features in the language that help his style of programming, which is very archaic. Zig has some really cool ideas that solve alot of the issues D has. It's currently not as "nice" to read and
<marler8997_> is missing some features, but the core of the language seems to be going in the right direction, and it's still young enough to make breaking changes and move in a new direction if it's deemed a better one (i.e. varargs vs tuples vs anonymous structs). I have alot more to say on the subject but I have to go for now. I was thinking of making a post about my experience porting a couple of my projects from D to Zig and explaining what
<marler8997_> I think the differences are.
Akuli has joined #zig
marijnfs_ has joined #zig
marijnfs_ has quit [Ping timeout: 248 seconds]
marijnfs_ has joined #zig
gamester has joined #zig
<gamester> marler8997_: Wow a heavy D user, nice! Many eons ago I was writing an application that needed to load and unload DLLs at runtime. I considered D but it had no ability to handle this simple task, at least without leaking memory. It struck me as a really weird thing to not have figured out for a language that seemed back then to be focused on systems programming. I've never grokked what D is trying to be.
<gamester> marler8997_: Now that C#/.NET is becoming open source, does that place C# as a competitor to D?
marijnfs__ has joined #zig
marijnfs_ has quit [Ping timeout: 272 seconds]
cameris has quit [Quit: leaving]
<scientes> gamester, C# is a virtual machine, while D is compiled to native code. they are totally different
<gamester> I disagree
<scientes> If Java a competitor to C++?
<gamester> D != C++
<gamester> D is a GC language
<gamester> with ability to sidestep it
<scientes> oh yes I forgot about that "better-C" doesn't have a gc however
<scientes> that was the part I was interested in
cyanmide has joined #zig
cyanmide has quit [Client Quit]
<gamester> There's also .NET Native now which precompiles your code to native code, statically links in the required portions of the .NET framework, and does global analysis on all of this. I don't know if you get an exe or something more like a dll.
<marijnfs> is there a reason why insertionSort is in an extra block?
cyanmide has joined #zig
jjido has joined #zig
<scientes> i think the other sort uses it
<marijnfs> I implemented a binarySort and it seems faster
Ichorio_ has joined #zig
<andrewrk> gonz_, hey thanks for the support
Ichorio has quit [Ping timeout: 252 seconds]
<andrewrk> I ran into a snag yesterday in the result location branch. went to bed frustrated but woke up with a solution
hio has quit [Quit: Connection closed for inactivity]
<tralamazza> hi andrewrk, I'm trying my hand at zig for embedded. I'm trying to avoid asm, while doing the startup code I think I stepped into a compiler bug (or at least crash) https://zig.godbolt.org/z/ACOnoy
marijnfs__ has quit [Ping timeout: 258 seconds]
<scientes> here is the backtrace to that http://paste.debian.net/1088093/
<scientes> tralamazza, you should probably report a bug so this can be tracked
<scientes> if the compiler crashes it is ALWAYS a bug
<tralamazza> I want a struct for my vector table (instead of an array), i thought of using the @typeInfo to do the @export weak at compile
<tralamazza> basically how i got to the bug
<scientes> actually he probably won't want to merge that based on the assert()
avoidr has joined #zig
<tralamazza> ty scientes
<tralamazza> but it seems to be a regression, since 0.4 does not crash
<andrewrk> tralamazza, fixed in master
<andrewrk> I mean, I just pushed a commit
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has joined #zig
<tralamazza> neat ty
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has joined #zig
Akuli has quit [Quit: Leaving]
donpdonp has quit [Ping timeout: 248 seconds]
jjido has quit [Read error: Connection reset by peer]
curtisf has joined #zig
ijneb has quit [Quit: ZNC 1.6.5+deb1+deb9u1 - http://znc.in]
Ichorio_ has quit [Ping timeout: 245 seconds]
marijnfs has quit [Quit: WeeChat 2.4]
porky11 has quit [Quit: Leaving]
avoidr has quit [Quit: leaving]
ltriant has joined #zig
<tralamazza> I'm trying to set the target in my build.zig, a bit confused how to set the subarch. I want something like exe.setTarget(builtin.Arch.thumb.v7m ...
<curtisf> What's the best way to format a chain of method calls in Zig? zig fmt puts them all on the same line which is hard to read. I can put a `//` at the end of each line but that's a bit weird
klltkr has joined #zig
kristoff_it has joined #zig
<gamester> curtisf: you can put a comma after the last argument like so: func(arg,)
kristoff_it has quit [Ping timeout: 248 seconds]
<curtisf> There aren't arguments here, I'm trying a "fluent" style: https://hastebin.com/ewizigeveq.zig
<curtisf> I think I'm more or less happy with how it looks though, since I'm being explicit where I want my breaks