ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
darithorn has joined #zig
<unique_id>
scientes: if is comptime if its condition is comptime
<scientes>
whats the syntax?
<unique_id>
just the normal if syntax
<scientes>
if (comptime foo) {]?
<unique_id>
if (foo)
<scientes>
but I want to put it in the if
<scientes>
to make it clean
<scientes>
like #ifdef HAVE_BAR
<unique_id>
Example from documentation, this is comptime: const separator = if (builtin.os == builtin.Os.windows) '\\' else '/';
<scientes>
having the comptime keyword there would improove readability IMHO
<scientes>
like assert()
<andrewrk>
scientes, that doesn't make sense from a scoping perspective
<andrewrk>
you can put comptime in front of the if, but then the body of the if has to be 100% comptime
<scientes>
I just want the if to be comptime
<andrewrk>
whereas you probably want the branch to be comptime but put runtime code in each prong
<scientes>
the condition
<scientes>
its like #ifdef/#else/#endif
<unique_id>
if (comptime expr) works
<unique_id>
reminds me of c++: if constexpr(expr)
<scientes>
oh ok
<unique_id>
I just tried it, didn't know before :)
<scientes>
should be in the docs
<scientes>
(should have tried myself)
<scientes>
is there a const for endianness?
<scientes>
I can't find it in the source or docs
<unique_id>
There's an entry in the docs called "Compile-Time Expressions" but it just shows this syntax: comptime {}, but there's a test case that shows "comptime expr" syntax. It does say that in the global scope all expressions are implicitly comptime
<unique_id>
scientes: there is, one sec
<unique_id>
if (builtin.endian == builtin.Endian.Little)
<unique_id>
Little/Big
<unique_id>
const builtin = @import("builtin");
<unique_id>
it is in the docs btw :)
<scientes>
oh there it is
<scientes>
ugggh @memcpy() type checking is too much
<scientes>
i'll go back to for () ||
<scientes>
inline for () ||
darithorn has quit [Quit: WeeChat 2.2]
<andrewrk>
hm I think those docs are wrong
<andrewrk>
nvm
<andrewrk>
I might change @memcpy to allow non-u8 pointers
<scientes>
andrewrk, yeah I think @memcpy should allow arbitrary pointers, its already unsafe with the non-overlap
<scientes>
but yeah I don't need to use it
<scientes>
I wrote a chacha20 implementation but there is still a bug or two cause i'm not getting the right results
<andrewrk>
scientes, btw did you see std.mem.copy?
kristate has joined #zig
<kristate>
back online from tokyo university
<kristate>
15pm JST
stratact has quit [Ping timeout: 240 seconds]
<kristate>
andrewrk: thinking about breaking-up the loop into separate files for each platform. importing event.loop will import the correct implementation for each OS and we will test the unified API in several test blocks inside of event.loop -- there is just too much custom code between the platforms and with threads, I want to make sure we get this right.
<kristate>
andrewrk: it's not as bad as you might imagine. only downside is if we find a bug in one implementation, we will have to make sure to track it down for each other files -- BUT, if we add the appropriate test case for that bug, we should be able to run against all implementations and if the bug does not show, then so be it
<kristate>
andrewrk: I think that this is going to be important as we go forward -- defining the interface as tests in an index file, and then making sure the tests pass in each implementation
<andrewrk>
kristate, I implemented the darwin file system stuff (not the watching yet) in my async-fs branch
<andrewrk>
I went the other direction with it - not having different files
<kristate>
andrewrk: yes, I see that -- but when we add FS watching in, things will get messy with CFLoopRun
<andrewrk>
I think it's better to have the same function definitions and types in one file, and that can switch out and import os-specific files if necessary
<andrewrk>
kristate, I see, alright my mind is open to your way
<andrewrk>
sorry I gotta get some sleep, I'll be back in ~8 hours
<kristate>
okay, yeah -- please rest well. I will try to get something hacked out with FS watch
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<andrewrk>
kristate, alright so now the problems we need to solve are: ability to build against core foundation when cross compiling, and only depending on it when it's used
<kristate>
andrewrk: agreed. I patched link.cpp, but I think we can do better
qazo has joined #zig
qazo has quit [Ping timeout: 244 seconds]
qazo has joined #zig
qazo has quit [Ping timeout: 244 seconds]
kristate has quit [Remote host closed the connection]
kristate has joined #zig
kristate has quit [Remote host closed the connection]
bheads has quit [Ping timeout: 240 seconds]
bheads has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
bheads has quit [Ping timeout: 256 seconds]
bheads has joined #zig
bheads has quit [Ping timeout: 240 seconds]
kristate has joined #zig
kristate has quit [Ping timeout: 256 seconds]
zolk3ri has quit [Quit: leaving]
zolk3ri has joined #zig
<MajorLag>
hmm... TypeInfo doesn't have a []Type for Fn arguments. Have to use @ArgType still.
zolk3ri has quit [Remote host closed the connection]
<MajorLag>
man, comptime caching really ruins a lot of complex use cases.
<MajorLag>
not even really that complex actually.
<MajorLag>
things like "iterate over the pub defs of struct A and see if they have a matching name and type pub def in struct B"
hooo has quit [Ping timeout: 252 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
qazo has joined #zig
<scientes>
there is an avoidance of @import("std") in the standard library, so that it refers to its own version. However this has the problem that all the test are always run
davr0s has joined #zig
noonien has quit [Quit: Connection closed for inactivity]