ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
tredizzle25 has joined #zig
nikki93 has quit [Read error: Connection reset by peer]
dch has quit [Ping timeout: 258 seconds]
l1x has quit [Ping timeout: 276 seconds]
scientes has quit [Ping timeout: 258 seconds]
tredizzle25 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qazo has quit [Ping timeout: 245 seconds]
l1x has joined #zig
dch has joined #zig
nikki93 has joined #zig
scientes has joined #zig
shritesh has joined #zig
shritesh has quit [Client Quit]
<tgschultz> andrewrk: are we not calling @bswap @byteSwap for some particular reason?
<scientes> i agree, byseswap is not much longer and it is clearer
scientes has quit [Ping timeout: 258 seconds]
<andrewrk> approved
<andrewrk> I was following the convention established by https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
<tgschultz> I wrote a packed array implementation. With a few changes it can save a byte and also be used with slices.
<tgschultz> tomorrow I'll check the efficiency on godbolt and if it isn't surprisingly inefficient I'd be willing to put a PR together to add it to std if desired.
<daurnimator> bswap is a very common shortening. I have no problem with byteSwap though. Also makes it less ambiguous in case we want @bitSwap to change bit endianess
<andrewrk> I think it should be `bswap` or `byteSwap` but not something in between
<tyler569> you never know, might want aswap and cswap someday
<andrewrk> I'm going to launch a new ziglang.org homepage tomorrow morning
<andrewrk> good night
marmotini_ has joined #zig
squeek502 has quit [Ping timeout: 255 seconds]
<emekankurumeh[m]> tgschultz: is it a sparse bitvector?
<hryx> new homepage hype
<emekankurumeh[m]> is it still going to be no js?
<presiden> nice
jevinskie has joined #zig
<torque> rather than no js we've reversed course entirely and the website will be completely rendered by wasm compiled from zig
<emekankurumeh[m]> really?
jevinski_ has joined #zig
jevinskie has quit [Ping timeout: 245 seconds]
squeek502 has joined #zig
squeek502 has quit [Ping timeout: 246 seconds]
squeek502 has joined #zig
marmotini_ has quit [Ping timeout: 258 seconds]
dch has quit []
ltriant has quit [Quit: leaving]
jjido has joined #zig
dch has joined #zig
tiehuis has joined #zig
<tiehuis> emekankurumeh[m]: i'm reasonably sure that it'll remain no js and plain html
<tiehuis> i think its more to reshuffle some content and make some examples more at the forefront and documentation accessibly etc
<tiehuis> however, i haven't talked with andrewrk or seen the changes so this is my assumption
<tiehuis> have to wait and see!
<daurnimator> tiehuis: huh. I didn't realise you had permissions to the repo
tiehuis has quit [Client Quit]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has joined #zig
nikki93 has quit []
jevinskie has joined #zig
nikki93 has joined #zig
jevinski_ has quit [Ping timeout: 246 seconds]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hio has joined #zig
very-mediocre has joined #zig
slugm has joined #zig
<hryx> I am happy to finally open #2405 (although it is still a draft and not all the tests pass yet) -- feedback welcome
marmotini_ has joined #zig
nullher0es has joined #zig
tyler569 has quit [Ping timeout: 252 seconds]
nullheroes has quit [Ping timeout: 252 seconds]
slugm has quit [Ping timeout: 268 seconds]
Vinski has quit [Ping timeout: 255 seconds]
slugm has joined #zig
Vinski has joined #zig
<tgschultz> emekankurumeh[m] it is packed, there are no gaps or extraneous information in the contiguous memory of the array.
<tgschultz> if you have PackedIntArray(i3, 300), it will occupy 113 bytes
slugm_ has joined #zig
slugm has quit [Read error: Connection reset by peer]
hio has quit []
scientes has joined #zig
jevinskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
shritesh has joined #zig
sgo has joined #zig
jevinskie has joined #zig
slugm__ has joined #zig
slugm_ has quit [Read error: Connection reset by peer]
marmotini has joined #zig
marmotini_ has quit [Ping timeout: 246 seconds]
marmotini has quit [Remote host closed the connection]
<andrewrk> it's live: https://ziglang.org/
slugm__ has quit [Remote host closed the connection]
slugm__ has joined #zig
sgo has quit [Ping timeout: 276 seconds]
<shritesh> woohoo
<redj> nice
<andrewrk> hmm I don't think this is going to land zig in social media today. what a shame
jevinskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jevinskie has joined #zig
<tgschultz> andrewrk: encountered using wget to download zig: ziglang.org appears to have an ipv6 entry but it doesn't respond?
tyler569 has joined #zig
<andrewrk> hmm let me have a look at something
<andrewrk> tgschultz, according to cloudflare ipv6 compatibility is on
halosghost has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Client Quit]
<tgschultz> andrewrk: https://pastebin.com/9dgAXL2B
<andrewrk> tgschultz, weird, it works for me
<tgschultz> ok, must be a problem on my end then.
hio has joined #zig
<strmpnk> I wouldn’t be surprised if an ISP is to blame. I sometimes disable IPv6 on some networks so it doesn’t even try the Happy Eyeballs “algorithm”.
<tgschultz> isp supports v6, confirmed by my firewall to be working, it's just trafic from the lan not being routed for some reason.
Sahnvour has joined #zig
<scientes> ipv6 works fine
<scientes> shawn@shawn-ThinkPad-L420:~/git/glibc$ ping6 ziglang.org
<scientes> PING ziglang.org(2606:4700:20::6819:2c6c (2606:4700:20::6819:2c6c)) 56 data bytes
<scientes> 64 bytes from 2606:4700:20::6819:2c6c (2606:4700:20::6819:2c6c): icmp_seq=1 ttl=58 time=201 ms
qazo has joined #zig
<tgschultz> yeah, it's a problem on my end. I'm trying to work out why, and the answer is becoming "there are reasons IPv6 never took off"
sgo has joined #zig
slugm_ has joined #zig
slugm__ has quit [Ping timeout: 246 seconds]
<donpdonp> heh
jjido has joined #zig
<tgschultz> here's a thing: if I change my struct from `struct` to `packed struct`, suddenly a member function throws "cannot evaluate constant expression".
<tgschultz> var value = @ptrCast(*const align(1) MinIo, &self.bytes[start_byte]).*;
<tgschultz> error points to `start_byte`, which is calculated earlier and at runtime.
meheleventyone has joined #zig
jjido has quit [Remote host closed the connection]
jjido has joined #zig
<scientes> tgschultz, it's more that when ipv6 is broken there isn't a high priority to fix it
meheleventyone has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<andrewrk> alright let me do another round of Pull Request review between now and the stream
TheLemonMan has joined #zig
<TheLemonMan> andrewrk, quick question about code organization, what do you think is the best layout for implementing different syscalls for different architectures in the linux layer?
<TheLemonMan> because I've got a i386 and a 32-bit ARM ports that are waiting to be upstreamed
<andrewrk> TheLemonMan, there's a pattern for that already, no? std/os/linux/arm64.zig std/os/linux/x86_64.zig
<andrewrk> I'm having a look at PRs now
<TheLemonMan> roger that, I'll split the syscalls requiring different handling into their own files
<TheLemonMan> #2374 is also related to this since I'm planning on using the 64bit file io on 32bit platforms
<andrewrk> got it
<tgschultz> andrewrk: https://pastebin.com/LA6zqHr9
<tgschultz> am I blind, or is this a bug?
<tgschultz> because this makes no sense to me
<andrewrk> tgschultz, definitely seems like a bug with packed structs. I don't see why the array index would need to be compile time known
<tgschultz> ok good, I'm not crazy. i'll make an issue.
<andrewrk> thanks
<tgschultz> other weird thing? this goes away if the array is smaller.
<andrewrk> that is very weird
<andrewrk> I did some big foundational changes to structs and especially packed structs just before 0.4.0 but there's another thing that needs to happen
<tgschultz> possibly has to do with alignment?
<andrewrk> yes
<andrewrk> I'm guessing this will be fixed with the implementation of https://github.com/ziglang/zig/issues/1512 and https://github.com/ziglang/zig/issues/2174
shritesh has quit [Ping timeout: 246 seconds]
<andrewrk> I let this slip by in code review, and I think it was a mistake https://github.com/ziglang/zig/blob/f8117a0799f6c691bf65f3b3f4726bf0e6fd6be2/src/analyze.cpp#L2250-L2257
<andrewrk> but it will be fixed with 2174
<andrewrk> anyway, one thing at a time. the bug report will be very welcome so that we can verify the problem is fixed
sgo has quit [Ping timeout: 250 seconds]
<andrewrk> looks like we get our social media day today after all
<donpdonp> ♥.zig
<halosghost> totally unrelated, but I don't know why ♥ (the Card Heart Suit) is more prevalently used than ❤ (heart)
<halosghost> :)
<tgschultz> guessing: the card heart is part of the extended ascii set?
<halosghost> tgschultz: U+2665
<halosghost> tgschultz: ❤ (heart) is U+2764
<halosghost> so, not quite
<halosghost> :)
<companion_cube> what's the social media day?
<halosghost> both are in the BMP though
<andrewrk> companion_cube, check hacker news, /r/programming and lobste.rs
<tgschultz> apparently it wasn't ascii I was thinking of anyway, but codepage 437. According to wikipedia, U+2665 == codepage 437 0x03
<tgschultz> which means, it is as simple as alt+numpad 3 to enter on windows
<companion_cube> hu, I guess these count as social media, ok
<andrewrk> how about "tech news day"?
<companion_cube> ✔
<halosghost> tgschultz: need to be able to enter hearts fast
<halosghost> tgschultz: personally, Compose means ❤ is just `compose < 3`
<halosghost> so, pretty quick here too :)
<strmpnk> I've gotten used to the new win-. shortcut for characters now. Finally something on par with macOS (though I still miss my custom text replacement rules that emulate latex syntax for typing mathy stuff).
mindfv has joined #zig
<andrewrk> tgschultz, I love your comment
<donpdonp> nng.h: typedef struct nng_aio nng_aio; translates to pub const struct_nng_aio = @OpaqueType();
<donpdonp> the .h doesnt seem to actually define nng_aio. what does that mean in C-land?
<andrewrk> donpdonp, a fwd decl. e.g. `struct nng_aio;`
<andrewrk> it might mean the struct had something in it zig didn't know how to translate
<donpdonp> does a forward declaration mean its declared elsewhere? i cant find a definiton anywhere in the .h folder :(
<andrewrk> donpdonp, that's sort of the point - by not providing the definition, it keeps the size of the struct out of the ABI, so future library updates are compatible with no recompilation needed
<donpdonp> interesting o^O
<andrewrk> you probably have to call some function which allocates memory and returns a pointer to the opaque type
<donpdonp> ah yes im trying to call nng_aio_alloc
<donpdonp> more specifically, nng_aio_alloc(nng_aio **aiop, ...) i see now its a ptr to memory that has been allocated by the functioncall.
<donpdonp> tricky!
<donpdonp> just when i thought my level of knowledge of c and zig points was sufficient, they throw a curve-ball :)
<donpdonp> is there a zig-ism to fill in a param to c.somefunc(value, <?*c_void> ) im currently having to c.somefunc(value, @intToPtr(?*c_void, 0))
<andrewrk> `null` should work
<donpdonp> heh. it does. thx!
<donpdonp> const myAio: [*c](?*c.nng_aio) = undefined; _ = c.nng_aio_alloc(myAio); c.nng_recv_aio(socket, myAio.*); => attempt to dereference undefined value
<donpdonp> is there a way to tell zig that its defined? i realize aio_alloc is defining/allocation outside of zig's view/control.
<andrewrk> donpdonp, look closely! the compiler found a bug
<andrewrk> also, never type these keys into your keyboard: `[*c]`
<donpdonp> i type that fairly frequently. #horrors.
<andrewrk> just use * or [*]
<donpdonp> oh maybe myAio shouldnt be const
<andrewrk> I'm going to consider adding extra hoops you have to jump through to use the [*c] type in a given file
<donpdonp> var myAio looks to be the winner.
slugm_ has quit [Remote host closed the connection]
<donpdonp> here's an example of using [*c]. c.wants_null(@intToPtr([*c]c.struct_nng_listener_s, 0)). that works, but c.wants_null(void) says expected type '[*c].cimport:8:11.struct_nng_listener_s', found '(null)'
<donpdonp> i meant to say c.wants_null(null) (not void)
<andrewrk> donpdonp, I think this is https://github.com/ziglang/zig/issues/1967
<andrewrk> this is a pretty high priority issue
* donpdonp nods
<Sahnvour> the final social media achievement would be making it to http://n-gate.com/hackernews/ :p
<donpdonp> var myAio is not the fix (from earlier example).
<tgschultz> unfortunately there are cases right now where you need to type [*c] in the form of a pointer cast.
<donpdonp> var myAio ends up being ?*.cimport:8:11.struct_nng_aio@aaaaaaaaaaaaaaaa, and the call to aio_alloc segfaults.
<donpdonp> andrewrk: can you give me a clue as to the error that the compiler found, that you mentioned earlier?
<andrewrk> aaaaaaaaaaa is the sound memory makes when it is undefined
<tgschultz> donpdonp: you dereferenced a pointer to uninitialized memory
<tgschultz> reading that again though, it looks like nng_aio_alloc was expected to initialize it?
<donpdonp> lol. aaaaaaaaaaa.
<donpdonp> i think i see now
<donpdonp> yup seems to be working. wohoo!
<donpdonp> var myAio: ?*c.nng_aio = undefined; c.nng_aio_alloc(&myAio);
<donpdonp> easy peasy.
<donpdonp> the call to actually use the value is recv_aio(socket, myAio); since zig doesnt know what c.aio_alloc() does, shouldnt that be a 'using undefined value' error?
<andrewrk> I'm about to start the live stream on https://www.twitch.tv/andrewrok/
<donpdonp> oh when myAio is used as a value, its the ptr not what it points to. I think thats the answer
* donpdonp joins the stream
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
halosghost has quit [Quit: WeeChat 2.4]
scientes has quit [Ping timeout: 252 seconds]
very-mediocre has quit [Ping timeout: 256 seconds]
Sahnvour has quit [Read error: Connection reset by peer]
mindfv has quit [Remote host closed the connection]
voldyman has joined #zig
shritesh has joined #zig
marmotini_ has joined #zig
darithorn has joined #zig
marmotini_ has quit [Remote host closed the connection]
adtac has joined #zig
<shritesh> andrewrk, thanks for the s/o on HN :)
<andrewrk> np, thanks for all the great work!
scientes has joined #zig
<shritesh> ...and the stream to. Missed it live. Watching it right now.
<shritesh> *too
<adtac> I'm trying to run a std library test and it appears --color off does not actually disable colours in test output error messages (not compilation errors)
<adtac> can anyone reproduce this?
<adtac> (master)
<andrewrk> adtac, I'm guessing you're seeing a stack trace?
<andrewrk> this is calling std.debug.dumpCurrentStackTrace, which does writeCurrentStackTrace(stderr, debug_info, wantTtyColor(), start_addr)
<adtac> yes
<andrewrk> looks like there isn't a way to force it off, but there is a way to force it on. the default is to detect if you're running in a terminal
<adtac> right, I guess I'll add that first :D
<adtac> --color off should permeate to stack traces when running zig test, correct?
scientes has quit [Remote host closed the connection]
<andrewrk> adtac, this is more of a general problem - e.g. what about if you just do `zig run foo.zig`
scientes has joined #zig
<adtac> same, --color off has no effect
<andrewrk> right, and the exe owns the args, see what I mean?
<adtac> ah
<adtac> should `zig run --color off foo.zig` work ideally then?
<adtac> `zig run foo.zig 2>&1 | cat` produces no colour as expected (not a terminal)
<mikdusan> workaround by nuking the tty: `zig test foo.zig |& cat` or whatever your shell needs for redirection; but actual source line is not emitted
<adtac> heh
<andrewrk> adtac, what about `zig build-exe foo.zig` and then `./foo`? See my point?
<andrewrk> I think an environment variable to control stack trace colors would be OK. there's already one in there to force it to be on. have a look at std.debug.wantTtyColor
<mikdusan> anecdotally, bsd and gnu tools seem to favor { `auto`, `never`, `always` } maybe zig should sync
<adtac> I agree that build-exe can't possibly control colours from the compile command, but I still think it's more intuitive to have test/run follow --color, no?
<andrewrk> mikdusan, sounds good