ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
kristate has joined #zig
wilsonk has quit [Ping timeout: 250 seconds]
diltsman has quit [Ping timeout: 256 seconds]
kristate has quit [Ping timeout: 246 seconds]
kristate has joined #zig
<emekankurumeh[m]>
does the freebsd ci even work? when i submit a pull request that has missing include files it builds just fine.
hio has quit [Quit: Connection closed for inactivity]
fsateler has quit [Read error: Connection reset by peer]
fsateler has joined #zig
kristate has quit [Remote host closed the connection]
kristate has joined #zig
<kristate>
andrewrk: hey, are you online?
<andrewrk>
hi kristate
<kristate>
hey
<kristate>
thinking aloud about #1953, but I always wondered why we allow undefined behavior in the first place (instead of using the error infrastructure).
schme245 has joined #zig
<andrewrk>
kristate, consider that the `+` operator can invoke undefined behavior
<kristate>
andrewrk: right, for these things, at the moment, we would have to panic, but for function calls where we can catch such things, wouldn't it be best to use the error infrastructure?
<andrewrk>
go on
<kristate>
andrewrk: well, we already have the compiler infra in place for calling-out to panic, so I wonder why we couldn't simply return an error up the stack instead of generating code to panic?
<kristate>
likewise, it might make sense to have a special builtin for @intToPtr when the int is zero, ala @zeroPtr and then make @intToPtr try-able,
<kristate>
try @intToPtr([*]const u8, 0) would generate an error.ZeroPointer (for example)
<kristate>
likewise, @intToPtr might be called with a runtime variable that is zero, or another address that might be out of bounds
<kristate>
right now, if you use try in a function that does not handle errors, the compiler complains, and that gives visibility to the programmer
<andrewrk>
that's an interesting idea
<kristate>
think of it this way, I know that we want @intToPtr to map as close as possible to llvm intrinsics, but at the same time, you would check code anyway to see if it equals a nullptr or not. try @intToPtr provides a very zig-way to do it, without the tacky if statement
<andrewrk>
what do you think should happen on implicit cast from C pointer to Zig pointer? e.g. `[*c]u8` to `*u8`
<kristate>
well, I think that there should first be a built-in to do it. it shouldn't be something you can just cast-down to. second, coming from C-land, a nullptr is technically not defined as 0, but is implemented as zero, so I think that this should be impossible: it should only be down-castable to ?*u8
<kristate>
andrewrk: this is debatable and something like bikeshedding, but perhaps ptr to zero should only be available as a [*c] ptr
<kristate>
would we ever have to cast down to *u8?
<andrewrk>
kristate, are you familiar with the motivation behind #1059? are you suggesting only that casting *to* zig pointers should not be implicit, or also *from*?
<andrewrk>
also, I apologize - I am a bit past my bedtime and I'm sure that I am not speaking with as much clarity as normal
<kristate>
andrewrk: please by all means, get some rest :-) about #1059, I am really glad that it is happening and fully supportive of it
<kristate>
andrewrk: maybe we can talk later about this subject. I will post this log as a comment on #1952
<DutchGh0st>
Which makes me realize, all the fancy constexpr if stuff he talks about, queries you can make like "does type x have method z?", you can all do in zig *currently*, right?
<emekankurumeh[m]>
i think so, it's just going to be very verbose
<DutchGh0st>
the examples he shows in the D language also are verbose
<euantor>
Endrei is very heavily involved with D if I remember correctly. I remember seeing a video where he was tlaking about some interesting stuff they do with strings, but unfortunately I can't find it now
<MajorLag>
emekankurumeh[m]: it isn't verbose if you use the stdlib: `const has_fn = std.meta.trait.hasFn("fnName")(Type);`
<emekankurumeh[m]>
I forgot about meta
ross_k has joined #zig
halosghost has joined #zig
<ross_k>
Hi, I'm trying to build the tetris demo (https://github.com/andrewrk/tetris) on Windows with zig 0.3.0. I've set up the include/link paths to GLFW and epoxy, and the last thing it's complaining about seems to be printf:
<ross_k>
error: no member named 'printf' in 'C:\Users\Ross\Downloads\tetris-master\src\c.zig' _ = c.printf(c"Error: %s\n", description);
<ross_k>
Tried running from the VS2015 developer command prompt
<ross_k>
(no difference)
<ross_k>
Final zig command line is:
<ross_k>
C:\Users\Ross\Downloads\zig-windows-x86_64-0.3.0+8e68d43a\zig.exe build-exe C:\Users\Ross\Downloads\tetris-master\src\main.zig --cache-dir C:\Users\Ross\Downloads\tetris-master\zig-cache --output C:\Users\Ross\Downloads\tetris-master\zig-cache\tetris.exe --name tetris --library c --library epoxy --library m --library png --library glfw --library z
<ross_k>
Is there an extra step I'm missing to point zig to the MSVC stdio?
jevinskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
scientes has quit [Ping timeout: 258 seconds]
barua has joined #zig
Zaab1t has quit [Quit: bye bye friends]
<andrewrk>
hi ross_k, I think I didn't get it building on windows yet.
<andrewrk>
oh, I see you got it building though - I think what happened is @cImport wasn't able to understand the way printf was defined in stdio.h (maybe it was a weird macro or something)
<andrewrk>
we can have a look at the .h file and see if that can be improved
barua has quit [Ping timeout: 250 seconds]
wootehfoot has joined #zig
very-mediocre has quit [Ping timeout: 256 seconds]
kristate has quit [Remote host closed the connection]
forgot-password has joined #zig
<schme245>
is there an issue for something like Jai's "using" keyword in Zig?
<schme245>
I tried to check on GitHub but that word is hard to search for!
<andrewrk>
schme245, that's where you embed one struct's fields into another, yes?
<schme245>
it might be used for that as well, the use case I'm thinking of is where it brings a structs variable into the scope
<andrewrk>
oh I see, you want to use the fields of the struct
<andrewrk>
I don't think that has been proposed, and I would predict resistance to that proposal from myself and others as well
halosghost has quit [Quit: WeeChat 2.3]
<schme245>
yeah, I kinda figured since it's pure typing avoidance and I know what Zig's stance on that is, but just wanted to throw the question out there!
schme245 has quit [Remote host closed the connection]
wootehfoot has quit [Read error: Connection reset by peer]