ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<MajorLag_>
is a ?&c_void returned by an extern fn treated specially? because it seems to behave differently than the same type as a field in an extern struct.
jfo has quit [Quit: WeeChat 1.9.1]
<MajorLag_>
or as returned by a non-extern fn, for that matter
<andrewrk>
can you elaborate?
<andrewrk>
?&c_void is not supposed to be special
<MajorLag_>
well I was trying to put together a minimal test case when I realized extern might be a factor. Don't think I'll be able to do that before I have to go though. Basically, if I call SDL_malloc I can do things with the result that I can't do with SDL_Surface.pixels. Specifically, I can cast it to a slice without a @ptrCast. If I return ?&c_void from a native fn (a fake malloc), I can't use ?? with it, but I can do that with SDL_malloc.
<andrewrk>
hmm I'll have to poke around with this
<MajorLag_>
error: slice of non-array type '?&c_void' is the error I get with SDL_Surface.pixels, error: incompatible types: 'void' and '&c_void' with fake malloc, even though the return type is explicitly ?&c_void.
<andrewrk>
it looks like you need to handle null
<andrewrk>
I gotta go AFK. feel free to file a bug and we'll get it sorted out one way or the other.
takeoffeveryzig has joined #zig
tridactyla has quit [Remote host closed the connection]
tridactyla has joined #zig
takeoffeveryzig has quit [Ping timeout: 260 seconds]
Topa has joined #zig
Topa has quit [Ping timeout: 256 seconds]
arBmind has quit [Ping timeout: 240 seconds]
Topa has joined #zig
Topa has quit [Ping timeout: 256 seconds]
Hejsil has quit [Read error: Connection reset by peer]
<tiehuis>
by the way, working casually on a regex engine in zig. i've got a rudimentary parser/compiler/vm right now, might have something decent in a month or so.
<tiehuis>
anyone had any pressing need for regexes yet?
Topa has joined #zig
Topa has quit [Ping timeout: 240 seconds]
jfo has joined #zig
<MajorLag_>
andrewrk: so yeah, it wasn't a bug. I just didn't realize that it's behaving differently because the type I was slicing was actually &c_void, having been unwrapped by ??. However, I think I found a bug while working that out, which I've submitted.
<tiehuis>
that error was actually fixed earlier today
jfo has quit [Ping timeout: 240 seconds]
<tiehuis>
if you pull the latest you should be okay
<MajorLag_>
Just my luck
<MajorLag_>
I see why I didn't find it by searching for "extern"
jfo has joined #zig
<tiehuis>
yeah, unlucky too that you were only one commit behind!
<jfo>
tiehuis: I was just thinking about regexes last night! what flavor are you using?
<tiehuis>
perl style I believe, although using a dfa approach so no backreferences and things
<tiehuis>
i haven't fleshed out much yet, still need to flesh out some of the compilation and do some refactoring
<tiehuis>
although sorry this only allows you to know if one of those match
<tiehuis>
so you wouldn't be able to dispatch in this case
<tiehuis>
i know that fast routers in go typically use a radix trie, which we could compute at compile time
<tiehuis>
those routers though usually are more limiting in their matching, however
jfo has joined #zig
<tiehuis>
also would be really cool to be able to get regex construction at compile-time for free
<tiehuis>
think the only thing blocking this right now is the ability to use allocators at compile-time
<tiehuis>
just going back to the regex group construction, if we had good enough regex simplification you could just construct one big regex of the alternation of all the routes
<tiehuis>
and then rely on the engine to simplify common literal prefixes
jfo has quit [Ping timeout: 265 seconds]
<andrewrk>
tiehuis, I think we can solve the allocators at compile time problem
jfo has joined #zig
<andrewrk>
not sure how to hook it up yet, but you should be able to allocate static storage with a comptime known size
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jfo has quit [Ping timeout: 256 seconds]
davr0s has joined #zig
<andrewrk>
maybe we could have @comptimeAllocate() and then we could use that to create a mem.Allocator at comptime and pass that to a function
<andrewrk>
I think this should work
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jfo has joined #zig
jfo has quit [Ping timeout: 252 seconds]
cenomla has joined #zig
jfo has joined #zig
davr0s has joined #zig
jfo has quit [Ping timeout: 256 seconds]
jfo has joined #zig
arBmind has quit [Quit: Leaving.]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]