ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
cmc has quit [Ping timeout: 260 seconds]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
isd has quit [Quit: Leaving.]
bb010g has quit [Ping timeout: 260 seconds]
clebermatheus[m] has quit [Ping timeout: 260 seconds]
dtz has quit [Ping timeout: 260 seconds]
raytracer[m] has quit [Ping timeout: 255 seconds]
lorde_kumamon[m] has quit [Ping timeout: 260 seconds]
kammd[m] has quit [Ping timeout: 277 seconds]
bheads has quit [*.net *.split]
n_1-c_k has quit [*.net *.split]
aiwakura has quit [*.net *.split]
aiwakura has joined #zig
n_1-c_k has joined #zig
bheads has joined #zig
darithorn_ has quit [*.net *.split]
tridactyla has quit [*.net *.split]
Aequus has quit [*.net *.split]
vec_ has quit [*.net *.split]
DuClare has quit [*.net *.split]
ltr_ has quit [*.net *.split]
darithorn_ has joined #zig
tridactyla has joined #zig
Aequus has joined #zig
vec_ has joined #zig
ltr_ has joined #zig
DuClare has joined #zig
JinShil has quit [Quit: Leaving]
JinShil has joined #zig
darithorn has quit [*.net *.split]
ofelas has quit [*.net *.split]
commander has quit [*.net *.split]
alandipert has quit [*.net *.split]
donpdonp has quit [*.net *.split]
andrewrk has quit [*.net *.split]
profan has quit [*.net *.split]
vec_ has quit [*.net *.split]
DuClare has quit [*.net *.split]
ltr_ has quit [*.net *.split]
darithorn_ has quit [*.net *.split]
tridactyla has quit [*.net *.split]
Aequus has quit [*.net *.split]
bheads has quit [*.net *.split]
n_1-c_k has quit [*.net *.split]
aiwakura has quit [*.net *.split]
Suirad has quit [*.net *.split]
monteslu has quit [*.net *.split]
cgag has quit [*.net *.split]
achambe has quit [*.net *.split]
bbrittain has quit [*.net *.split]
s455wang has quit [*.net *.split]
MajorLag1 has quit [*.net *.split]
m6w6 has quit [*.net *.split]
dpk has quit [*.net *.split]
occivink has quit [*.net *.split]
pancake has quit [*.net *.split]
crimson_penguin has quit [*.net *.split]
Tobba has quit [*.net *.split]
jzelinskie has quit [*.net *.split]
bodie_ has quit [*.net *.split]
meena has quit [*.net *.split]
epsyloN has quit [*.net *.split]
chandlore_ has quit [*.net *.split]
return0e_ has quit [*.net *.split]
t5c has quit [*.net *.split]
hinst_ has quit [*.net *.split]
minus has quit [*.net *.split]
koomi has quit [*.net *.split]
_whitelogger has joined #zig
<andrewrk>
darithorn, no runtime reflection - but you can use comptime reflection to create a lookup table that you can use at runtime
<darithorn>
good idea i didn't even bother thinking about doing that.
donpdonp has quit [Changing host]
donpdonp has joined #zig
bb010g has joined #zig
kammd[m] has joined #zig
lorde_kumamon[m] has joined #zig
dtz has joined #zig
clebermatheus[m] has joined #zig
raytracer[m] has joined #zig
cenomla has quit [Quit: cenomla]
darithorn has quit [Quit: Leaving]
cenomla has joined #zig
cenomla has quit [Quit: cenomla]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
return0e_ has quit []
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
quc has joined #zig
Ichorio has joined #zig
quc has quit [Remote host closed the connection]
quc has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
cenomla has joined #zig
isaachier has joined #zig
darithorn has joined #zig
cenomla has quit [Read error: Connection reset by peer]
cenomla has joined #zig
<darithorn>
when I create a generic struct e.g. `fn Foo(comptime T: type) type` in a local scope is that struct and any functions in it "freed" at the end of the scope?
<isaachier>
presumably it is stack allocated
<isaachier>
no "freeing" really needed
isaachier has quit [Quit: Page closed]
cmc has quit [Ping timeout: 260 seconds]
<andrewrk>
darithorn, declaring a struct is a compile-time operation
<darithorn>
that's what i figured and that i didn't need to worry. I just wanted to make sure
<andrewrk>
types do not take up any space at runtime
<darithorn>
I create a generic struct that creates a generic function and I pass that function into a c library that stores that function pointer for later use
<darithorn>
pretty much like a callback system
<andrewrk>
darithorn, the pointer will be pointing to a statically known address in your binary
<andrewrk>
every instance of the generic function exists when your program starts
<andrewrk>
it's pretty convenient, eh? :)
bheads_ has joined #zig
<darithorn>
yeah. if I could just figure out how to register those callbacks automatically, given a struct type, then this would be perfect
bheads has quit [Ping timeout: 245 seconds]
<andrewrk>
you probably need to generate a list at compile-time of fn ptr and other data needed to register, then on startup iterate over this list and call the C functions to register them
<darithorn>
that's what i did normally but it meant that all my zig functions would have to have the same signature and it was just a mess
<darithorn>
i wanted to create a wrapper, which is what that generic function from earlier does (just manually)
<andrewrk>
feel free to link me to your code if it's open source and I'll see if I can make any suggestions
<darithorn>
i'm working on a binding/wrapper for the godot engine
Skilfingr has joined #zig
<darithorn>
the c++ wrapper for godot engine does similar where it wraps the method
<darithorn>
I have it working manually, where you call registerMethod for every function you want to register to the engine but I'm trying to automate it so a single call to `registerClass` would register every function for you
<andrewrk>
I'm pretty sure it is possible
<darithorn>
the problem i'm having trouble getting over is wrapping them. if you don't wrap them then every function has to have a signature of `(godot_object *, void *method_data, void *user_data, int num_args, godot_variant **args)`
<andrewrk>
having to use ?? is common when doing direct .h file imports. but if you are making a wrapper (which it looks like you are doing) then I recommend using `zig translate-c` and save the output. Then you can clean it up by removing `?` from some pointers
<andrewrk>
if you're going through the trouble of making a wrapper, I think it's better to avoid @cImport
quc has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<darithorn>
true, i didn't think about that. i'll do that once i start cleaning this up after i get it mostly working
<isaachier>
I was try to implement a regex engine for zig using pcre but I found the output of translate-c was a bit too C-like to be idiomatic.
<isaachier>
trying*
<isaachier>
Started a new one from scratch in pure zig here: https://github.com/isaachier/regex. Doubt it will be as performant as pcre though (at least for now).
<andrewrk>
isaachier, did you see tiehuis's engine?
<isaachier>
no but awesome. mine was more for my own learning anyway. haven't really invested that much time into it.
<andrewrk>
neat
<andrewrk>
I'd be interested int trying to make one that supports compiling at comptime
cenomla has quit [*.net *.split]
ofelas has quit [*.net *.split]
commander has quit [*.net *.split]
alandipert has quit [*.net *.split]
cenomla_ is now known as cenomla
<isaachier>
ya that was my thoughts as well. comptime compilation/jit would be fantastic.
alandipert has joined #zig
jjido has joined #zig
jjido has quit [Client Quit]
isaachier has quit [Quit: Page closed]
ofelas has joined #zig
bheads__ has joined #zig
bheads_ has quit [Ping timeout: 248 seconds]
bheads_ has joined #zig
bheads__ has quit [Ping timeout: 260 seconds]
bheads__ has joined #zig
bheads_ has quit [Ping timeout: 265 seconds]
<Skilfingr>
When the compiler quits with "unreachable" (then crashs), what is the meaning? What is the best way to find out why?
<Skilfingr>
I guess my question should be, how can i write log messages while compiling
<darithorn>
you can use @compileLog
<Skilfingr>
thx. somehow i did not find it. only @compileError
<darithorn>
also my process is to add small bits of code at a time and compile often. that way if i run into an `unreachable` or similar then i know it's from the last few lines of code i added
<Skilfingr>
I try to create a gl loader by modifying an existing generator for c. I generated a ton of errors and try to solve them step by step. Now I do not know till where did the compiler run. But I will find out now :D
<andrewrk>
Skilfingr, you can find out where it crashed with gdb
<andrewrk>
usually there is an IrInstruction or an AstNode which you can use to track down source file, line, column
<andrewrk>
to be clear, this is a compiler bug when this happens
jjido has joined #zig
n_1-c_k has quit [Read error: Connection reset by peer]