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 has joined #zig
MajorLag has quit [Ping timeout: 245 seconds]
wink_ has quit [Ping timeout: 252 seconds]
wink_ has joined #zig
mnoronha has quit [Ping timeout: 252 seconds]
mnoronha has joined #zig
darithorn has quit []
jjman has joined #zig
jjman has quit [Quit: WeeChat 1.6]
mnoronha has quit [Ping timeout: 246 seconds]
bheads has quit [*.net *.split]
bheads has joined #zig
ManDeJan has joined #zig
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
walac has quit [Ping timeout: 250 seconds]
walac has joined #zig
allochi has joined #zig
walac has quit [Ping timeout: 252 seconds]
<euantor>
Awesome, thanks tiehuis. I did have the compiler building but then failing tests, but I'm now not even getting that far
<euantor>
I'm getting `Unable to create builtin.zig: invalid format` when trying to run `./zig build --build-file ../build.zig test -Dskip-release-small`, which seems to be another CPP problem
walac has joined #zig
kmelva has joined #zig
walac has quit [Ping timeout: 260 seconds]
walac has joined #zig
davr0s has joined #zig
walac has quit [Ping timeout: 252 seconds]
walac has joined #zig
allochi has quit [Remote host closed the connection]
allochi has joined #zig
allochi has quit [Ping timeout: 252 seconds]
allochi has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
very-mediocre has quit [Ping timeout: 256 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ichorio has joined #zig
davr0s has joined #zig
darithorn has joined #zig
return0xe has quit [Ping timeout: 245 seconds]
<andrewrk>
if I pull of this coroutine rewrite as planned, zig will support stackless heapless functions
Jenz has joined #zig
<Jenz>
What does the * in the c string type: `[*]const u8` mean?
<andrewrk>
Jenz, it means: at the address pointed to, there are an unknown number of contiguous items
<Jenz>
andrewrk: Ok, thanks; makes sense
<andrewrk>
after https://github.com/ziglang/zig/issues/265 is implemented, the type would be `[*]null const u8` which means: at the address pointed to, there are a number of contiguous items. After the last one, there is a sentinel u8(0)
<Jenz>
I like that better :D
<bheads>
how would stackless work?
<andrewrk>
bheads, status quo coroutines are stackless
<bheads>
right, but they get memory from some allocator right?
<andrewrk>
right
<bheads>
which is either stack or heap memory...
<bheads>
so you said coros without any memory
<andrewrk>
fair, that's a bit misleading. the memory has to go somewhere
<Jenz>
andrewrk: Some projects has things like "good first issue"s, anything similar for newcomers in zig?
<Jenz>
Personally; Im terrible at C++, new to zig; and not really sure if there's any way at all I can help out ATM
<andrewrk>
bheads, but in the rewrite, coroutines are not coupled to allocators - you pass a pointer to the frame when you async call a function
<bheads>
ah so you can just pass the frame
<andrewrk>
I think it's going to be a big deal, if I can only figure out how to make async function pointers work
<andrewrk>
Jenz, one of the best things you can do is to simply have a project in zig that you're working on
<andrewrk>
and then report bugs and use cases that zig doesn't handle very well
<Jenz>
Yeah ok, thanks again :)
<Jenz>
Then I'll just keep doing what Im doing
<andrewrk>
:)
<bheads>
humm... recurrsion is really hard to solve... I can think of ideas for the simple cases but the hidden recursion sucks
<andrewrk>
bheads, yeah. I've solved recursion when the function being called is not a pointer (when the compiler knows what function you're calling at compile time)
<andrewrk>
but recursion + async + function pointers is a tough nut to crack
<bheads>
would if detect more complex recursion
<bheads>
like a-> b->c ->d ->(a or b)
<bheads>
stuff like this?
<andrewrk>
yeah it would just detect a call graph cycle and force you to use stackless functions (coroutines) for the recursion
<bheads>
okay cool
<andrewrk>
but I haven't solved recursion + function pointers
<andrewrk>
my first thought was that you could jsut annotate the set of functions that a pointer *migth* be
<bheads>
for fn pointers I think you have to detect the cycle in runtime
<andrewrk>
but that defeats the point of e.g. an Allocator interface or OutStream interface
<andrewrk>
oh that's interesting. I hadn't considered that
<andrewrk>
so the compiler would know there is a potential cycle, and insert a safety check
<bheads>
in debug mode you can mark each stack frame
<andrewrk>
we'd have a way to anotate how many cycles were allowed
<andrewrk>
so that the compiler could count that in its stack size consideration
<andrewrk>
and then going beyond that trips a runtime safety check
<bheads>
that would be really cool
DutchGh0st has joined #zig
<bheads>
and turn it all off in release mode
<andrewrk>
of course
<andrewrk>
on in ReleaseSafe mode though!
<DutchGh0st>
how does `some_number / comptime_int` work?
<bheads>
lol
<DutchGh0st>
because Im trying divExact, divTrunc, but somehow something seems to go wrong
<bheads>
I think all constant numbers are comptime_
<bheads>
and the compiler does the casting checks
<andrewrk>
DutchGh0st, do you have a code example that is giving unexpected results?
<DutchGh0st>
it might be I screwed up, but 2 seconds, Ill push it
<DutchGh0st>
dont look at itoa_u64, it forwards to itoa(),
<DutchGh0st>
the numbers 1, 0, 0 should be written into `buf` in the test, but I screwed up something I guess?
<andrewrk>
DutchGh0st, itoa_u64(n, buf[0..].ptr, 3), this could better be written itoa_u64(n, &buf, buf.len)
<DutchGh0st>
ah yeah
<bheads>
or just passed as a slice
<DutchGh0st>
[*]T also takes slices?
<bheads>
[]T is a slice
<DutchGh0st>
but I have a star in the braces,
<bheads>
if you know the length its safer to use a slice
<DutchGh0st>
but that is not C compatible
<andrewrk>
the code is calling an extern function
<bheads>
ah your making a c interface
<bheads>
god I hate
<bheads>
C
<DutchGh0st>
the idea was to make 1 generic function for converting numbers into a sequence of bytes, and then verry quickly write like 'itoa_u64', 'itoa_u32' etc
<andrewrk>
DutchGh0st, I haven't figured anything out, but have you tried using @compileLog to debug your comptime code?
<DutchGh0st>
@compileLog, I FORGOT ABOUT THAT
<DutchGh0st>
thanks :)
<DutchGh0st>
@divExact does not modify the numbers you put in, right?
<andrewrk>
DutchGh0st, correct
<Jenz>
Is there a way to programaticalyl get the type of os.args() ?
<andrewrk>
Jenz, I don't understand the question, can you elaborate on what you're trying to do?
<Jenz>
Hehe, very -- what should I say... -- hotelesque way of putting it :P
<Jenz>
Nvm. Im just a bit of an idiot
<Jenz>
(I know "hotelesque" is not at all a word)
<DutchGh0st>
while(n != 0) ({n -= 1;}) {} <-- does that check the condition, subtracts 1, and THEN does the body?
<jfondren>
f.e., you add a payment method later on, and zig tells you about all the switches you have to update to handle the new payment.
<andrewrk>
jfondren, ah, yes. apologies if I mislead you before
<andrewrk>
what is ML? Machine Learning? Mat-Lab?
<jfondren>
nobody mislead me :) first time I'm mentioning it. I just thought they weren't in the language since there wasn't mention of them
<jfondren>
Robert Milner's language ML. like Standard ML, OCaml. Although lots languages have these kind of types
<jfondren>
it's how FP langs implement optional types, usually.
<jfondren>
in ML they compile to structs (or ints, when there are no arguments) with an int field that says which constructor you have, which is what gets switched on at runtime
<jfondren>
I imagine this Zig code is compiled to something a little different, but that's not as important
<andrewrk>
jfondren, not that it matters too much but you can replace union(Payments) with union(enum) and have the tag type inferred
<jfondren>
cool, ty
<jfondren>
*Robin Milner
tobbez has joined #zig
halosghost has quit [Quit: WeeChat 2.2]
<andrewrk>
ok here's a crazy idea
<andrewrk>
calling a function pointer requires special syntax
<andrewrk>
one does not simply call a function pointer
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<andrewrk>
when you call a function pointer, use @fnPtrCall(comptime required_stack_bytes_upper_bound: usize, function: var, args: ...)
<andrewrk>
runtime safety checks to make sure that the actual function called, its stack requirements do not exceed the value
mnoronha has joined #zig
Ichorio has quit [Ping timeout: 245 seconds]
mnoronha has quit [Ping timeout: 252 seconds]
mnoronha has joined #zig
mnoronha has quit [Ping timeout: 246 seconds]
mnoronha has joined #zig
mnoronha has quit [Read error: Connection reset by peer]