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/
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 252 seconds]
<andrewrk> Xe: that example with json parsing sounds a lot like erlang
<Xe> i'm going to have to look more into erlang
<andrewrk> I saw your blog article on lobsters this morning! Fun stuff. Also liked the templeos one
<Xe> :D
<Xe> i like how easy it is to reason about memory in zig
<Xe> i don't have to fight anything
<Xe> andrewrk: thanks again for your work on zig, so much
<Xe> it's making programming fun
lygaret has joined #zig
<andrewrk> Xe: glad to hear it. I agree with you, I just wish it was at 1.0 already
<Xe> you and me both
<andrewrk> Making a programming language is a means to an end for me... Not the end in and of itself
marijnfs__ has joined #zig
marijnfs_ has quit [Ping timeout: 248 seconds]
lygaret has quit [Quit: Leaving.]
redj has quit [Read error: Connection reset by peer]
redj has joined #zig
return0e has quit [Read error: Connection reset by peer]
return0e_ has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 272 seconds]
return0e has joined #zig
return0e_ has quit [Ping timeout: 268 seconds]
redj has quit [Read error: Connection reset by peer]
redj has joined #zig
porky11 has joined #zig
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 258 seconds]
avoidr has joined #zig
_whitelogger has joined #zig
<daurnimator> Is there a 'sliceCast' around
<daurnimator> This isn't pretty.... @ptrCast([*]myType, x.ptr)[0..x.len*@sizeOf(x[0])/@sizeOf(myType))
Ichorio has joined #zig
_whitelogger has joined #zig
<nrdmn> are there any linux kernel modules in zig yet?
corecode has quit [Ping timeout: 258 seconds]
tralamazza has quit [Ping timeout: 276 seconds]
tralamazza has joined #zig
<daurnimator> nrdmn: nope. though that's something I've been wanting to see
<nrdmn> daurnimator: now there is one: https://github.com/nrdmn/zig_kernel_module
<daurnimator> nrdmn: I'm curious if you can rewrite some of the macros (e.g. module_init/module_exit/MODULE_LICENSE) in zig
<nrdmn> I'm sure that would be possible, but it'd break if the kernel devs decide to change the module api
corecode has joined #zig
corecode has left #zig [#zig]
<nrdmn> I'm not quite happy yet with how I included printk. It happens to be compiled into stub.o (pulled in by linux/module.h).
<nrdmn> And I wouldn't want to extend stub.c for any kernel function that I use
<daurnimator> nrdmn: can you not just: @cImport("include/linux/printk.h");
return0e has quit [Read error: Connection reset by peer]
<nrdmn> daurnimator: this is what I wrote: const kernel = @cImport(@cInclude("linux/printk.h"));
<nrdmn> this is what I'm getting: http://dpaste.com/11FJHPG
porky11 has quit [Ping timeout: 252 seconds]
<daurnimator> nrdmn: don't you need to add `-isystem /lib/modules/$(uname -r)/build/include` to your zig invocation?
return0e has joined #zig
<nrdmn> hmm, still getting the same error messages as before. The kernel's makefile does quite a bit of other stuff and I'm not sure replicating all of this in zig is the right way
<daurnimator> nrdmn: can you see what -D arguments the makefile passes?
<daurnimator> you could then add them with @cDefine
<daurnimator> (use V=1 with the kernel makefile)
<nrdmn> there must be some way that doesn't circumvent the kernel's build system, no?
<daurnimator> maybe can look at how kernel modules written in rust or fortran are done? I think there might be one or two around?
<nrdmn> I've been looking at this one: https://github.com/tsgates/rust.ko
<andrewrk> My marathon race starts in 14 minutes
<nrdmn> andrewrk: good luck!
<scientes> wow, 26.2 miles andrewrk ?
<scientes> oh hes already offf...
<daurnimator> nrdmn: well now I'm just finding zig bugs :)
<daurnimator> nrdmn: e.g. cimport.zig:335:27: error: invalid digit: '"' pub const KERN_SOH = c"\x1";
<daurnimator> ==> zig's @cImport is generating invalid zig internally
<andrewrk> I posted a pic on Twitter. Spot the Easter egg
<nrdmn> spotted :D
very-mediocre has joined #zig
<Xe> you know what you doing
porky11 has joined #zig
<nrdmn> daurnimator: is it really that simple?
<daurnimator> nrdmn: maybe.... trying to iron out the kinks...
<daurnimator> okay another zig bug I think.... if you try and export the result of a comptime function call it gets replaced with zeros
<nrdmn> daurnimator: this doesn't happen with [n]u8
<daurnimator> nrdmn: oh right... is it trying to export the slice?
<daurnimator> instead of the contents
<nrdmn> seems so
<daurnimator> nrdmn: yep that was it. fix incoming
<nrdmn> how would you export a slice if you actually wanted to? Append [0..] to the function call?
<daurnimator> nrdmn: I think slices don't have a defined memory layout; it should be a compile error to export one.
<daurnimator> nrdmn: gist updated
<nrdmn> oh, I got zig to segfault :D
<nrdmn> daurnimator: can you reproduce that?
<daurnimator> nrdmn: btw also just filed https://github.com/ziglang/zig/issues/2612
<daurnimator> nrdmn: nope. I get this error with your sample: https://github.com/ziglang/zig/issues/2611
<nrdmn> now after I've changed some of my include paths I'm getting cimport.zig:341:27: error: invalid digit: '"'
return0e has quit [Ping timeout: 272 seconds]
return0e has joined #zig
very-mediocre has quit [Ping timeout: 256 seconds]
<nrdmn> daurnimator: what did you change?
<daurnimator> nrdmn: well I commened out the actual printk calls pending issue 2611
<daurnimator> nrdmn: but otherwise I realised the vermagic is taken care of by the kernel build system
very-mediocre has joined #zig
<nrdmn> daurnimator: why did you name the constant at the bottom _1?
<daurnimator> nrdmn: see https://github.com/ziglang/zig/issues/2610#issuecomment-498036121 > If I try and have two different variables called _ it fails with error: exported symbol collision: '_', redefinition of '_'
<daurnimator> nrdmn: simple fix :)
<daurnimator> nrdmn: get much further with that fix?
<nrdmn> I haven't tried yet, wait a sec
<nrdmn> hmm, I'm getting a different error message for #2611. What version of zig are you using?
<daurnimator> nrdmn: pretty much master
<daurnimator> nrdmn: I applied your fix and am now getting an assertion elsewhere
<daurnimator> https://bpaste.net/show/7281e82a14b1 <-- stack trace
<nrdmn> without it, I get `invalid digit: '"'`
<daurnimator> nrdmn: oh I think your fix is correct. just now it gets further into compiling printk.h and fails more spectacularly
<nrdmn> what did you change?
<daurnimator> nrdmn: in my gist I uncommented the defines of __KERNELL__ and MODULE, and uncommented the include of printk;
return0e has quit [Ping timeout: 272 seconds]
return0e has joined #zig
<nrdmn> now I'm getting an assertion too, but no stack trace :(
<daurnimator> nrdmn: the stack trace may take a while to appear
kristoff_it has joined #zig
<nrdmn> daurnimator: have you been able to reproduce my observation in https://github.com/ziglang/zig/pull/2615?
kristoff_it has quit [Ping timeout: 248 seconds]
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 244 seconds]
hio has joined #zig
fengb has joined #zig
<fengb> Oops... reading logs for yesterday
<fengb> ^ total non-sequitor today :P
Akuli has joined #zig
<Akuli> how do i tell zig 0.4.0 to put the compiled executable to a sane location? i'm using build.zig, and it keeps hiding the executable to zig-cache/o/qHOQFrFreaVliU2TIscbHp3BtJO8fee1IdR1b84dJsN1_1ayT-zpIlj7fziI3hVf/nameofexecutable or something
fsateler has joined #zig
<Akuli> i wasn't able to do that, but i was able to make it run my program with an argument http://dpaste.com/0RJ693S
<Akuli> then: $ zig build run -Dfile=some/path/to/file
<emekankurumeh[m]> i usually do "builder.setInstallPrefix(".");" and run `zig build install` when you will put the executable in bin in your cwd
<Akuli> nice
gamester has joined #zig
<gamester> Akuli: exe.setOutputDir("...")
<gamester> const exe = builder.addExecutable("name", "main.zig"); exe.setOutputDir("dir")
gamester has left #zig ["Leaving"]
Akuli has quit [Quit: Leaving]
very-mediocre has quit [Quit: Page closed]
rain2 has joined #zig
rain1 has quit [Ping timeout: 245 seconds]
cameris has joined #zig
Ichorio has quit [Ping timeout: 250 seconds]
fengb has quit [Ping timeout: 256 seconds]
porky11 has quit [Quit: Leaving]
pellsson has quit [Ping timeout: 246 seconds]
cameris has quit [Quit: leaving]
mrkishi has joined #zig
marijnfs has joined #zig
sammich has quit [Read error: Connection reset by peer]
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 258 seconds]
marijnfs has quit [Quit: WeeChat 2.4]
<tgschultz> man, really need @unionInit() right now
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 252 seconds]
fsateler has quit [Quit: ZNC 1.7.2+deb2 - https://znc.in]
<mrkishi> hey, folks. just experimenting with zig and really enjoying it so far. I hope you don't mind some newbie questions coming your way :P