ChanServ changed the topic of #zig to: zig programming language | | be excellent to each other | channel logs:
<g-w1> no more libc!
<g-w1> how did you become a better programmer? just by writing code?
<lemmi> isn't complaining and wishing a lot the normal way to get better at things?
<lemmi> writing code? can't be that simple, can it?
<andrewrk> g-w1, yep just by exploring my interests
<andrewrk> probably I learned the most when I did something a second time
<andrewrk> it's a lot easier to read other peoples' writings and advice about technical stuff if you already tried to do it yourself first and ran into the problems firsthand
<g-w1> agreed! that has happened to me multiple times. thanks for the insights
Falconerd_ has quit [Quit: Falconerd_]
<g-w1> small patch coming up for array type size needing to be comptime and correct source location for redundant comptime
<g-w1> ah nvm, array size already works since its in typeExpr. i will just fix the src location hten
<g-w1> *then
olabaz has left #zig ["WeeChat 2.3"]
xackus has quit [Read error: Connection reset by peer]
xackus_ has joined #zig
<andrewrk> g-w1, I nabbed it real quick
<g-w1> oop, looks like you were too fast :P
<g-w1> could the body of typeExpr be just `return comptimeExpr(gz, scope, .{ .ty = .type_type }, type_node);` ?
<andrewrk> yes it could
<g-w1> ok, not important, but something for me to keep in mind
gazler_ has joined #zig
gazler has quit [Ping timeout: 252 seconds]
<recalloc> More fanning: really appreciate the design pattern in std where one struct (e.g. Random or Allocator) is provided by multiple engines to let the user decide which to use instead of a single default :)
<recalloc> I know when I worked in Python there's simply an out-of-the-way dont-worry-how-it-works random.Random, but knowing I can in-place substitute the Algo when I want to has just the best feeling
xackus_ has quit [Read error: Connection reset by peer]
xackus__ has joined #zig
earnestly has quit [Ping timeout: 252 seconds]
<andrewrk> that's just good ol' object oriented programming :)
<oats> andrewrk: it's been really inspirational seeing your work on zig over the last couple years, stuff like this has helped keep me going working on my degree :)
xackus has joined #zig
xackus_ has joined #zig
xackus__ has quit [Ping timeout: 240 seconds]
xackus has quit [Ping timeout: 240 seconds]
<andrewrk> :)
zenkuro has quit [Ping timeout: 268 seconds]
<recalloc> More a complement on zig's stl than core language design. It feels much cleaner than most other stdlib's I've personally used
xackus has joined #zig
xackus_ has quit [Ping timeout: 265 seconds]
xackus has quit [Ping timeout: 252 seconds]
<andrewrk> thanks! btw have you had a chance to play with hash maps yet? I feel like the std lib hash maps are pretty excellent
<andrewrk> std.AutoHashMap(K, V)
<andrewrk> that's something I sorely missed in C
<shachaf> Does the standard library being MIT-licensed mean approximately every program compiled with Zig needs to include the copyright notice?
<andrewrk> no you don't need to do that
<shachaf> Why not, if you're linking the standard library?
<andrewrk> the license governs what you can do with the source files, not compiled artifacts
<andrewrk> what you're not supposed to do is copy zig and delete the license, or fork zig and delete the license
<andrewrk> basically, if you're using zig source code, don't try to hide that it comes from zig
<shachaf> Wait, really? MIT license doesn't mean you have to include a copyright notice with compiled copies?
<shachaf> That doesn't sound like the standard interpretation. It would be good if the license made that clear.
<andrewrk> citation needed
<shachaf> I don't know what I would cite.
<andrewrk> what problem are you trying to solve?
<shachaf> I just noticed the license and was curious about it.
<shachaf> My understanding is that any program that uses an MIT-licensed library, even if only in compiled form, has to include the copyright notice.
<waleee-cl> shachaf: the std isn't distributed compiled tho?
<shachaf> It's compiled into most executables.
<waleee-cl> you'd be seriously f*cked if you had to gpl-license everything compiled by gcc then
<shachaf> You don't, because gcc doesn't statically link any libraries. The license of the compiler isn't relevant.
<shachaf> (And you often can't statically link glibc, since it's LGPL-licensed, I think.)
<recalloc> Haven't seen a need for zig hashmaps yet. I've just been making very small SDL games with it for now
<shachaf> Ah, GCC does statically link a small amount -- crt1.o etc. -- and that has a special exception:
<waleee-cl> shachaf: ok, that was a bad example
<waleee-cl> but I'm not seeing the heaps of licenses that would be the implication on eg. my phone or elsewhere.
<recalloc> Really appreciate std.StaticBitSet, though! Really appreciate how types-as-comptime-values lets the compiler decide what uint type makes most sense for the bitarray size.
<waleee-cl> (the phone has exactly 3 licenses that I found, 2 of them for video codecs)
<waleee-cl> ok, that was a lie. Apparently loads more if you had activated the developer mode
<waleee-cl> * loads more was listed
<shachaf> My Android phone has a very long list of third-party licenses.
<waleee-cl> yeah, I discovered that now. I hadn't checked post-enabling dev mode on mine
r0bby has joined #zig
zenkuro has joined #zig
v0idify has quit [Ping timeout: 240 seconds]
v0idify has joined #zig
sord937 has joined #zig
notzmv has quit [Ping timeout: 252 seconds]
ur5us_ has quit [Ping timeout: 240 seconds]
zenkuro has quit [Ping timeout: 252 seconds]
zenkuro has joined #zig
mikdusan1 has joined #zig
mikdusan has quit [Ping timeout: 268 seconds]
notzmv has joined #zig
mikdusan1 has quit [Ping timeout: 268 seconds]
[wtf] has joined #zig
notzmv has quit [Ping timeout: 252 seconds]
cole-h has quit [Ping timeout: 240 seconds]
mikdusan1 has joined #zig
meinside has quit [Quit: Connection closed for inactivity]
leon-p has quit [Quit: leaving]
mikdusan1 has quit [Quit: WeeChat 3.0.1]
earnestly has joined #zig
mikdusan has joined #zig
recalloc has quit [Ping timeout: 246 seconds]
recalloc has joined #zig
mikdusan has quit [Ping timeout: 252 seconds]
mikdusan1 has joined #zig
jokoon has joined #zig
Guest72431 has joined #zig
ur5us_ has joined #zig
ur5us_ has quit [Ping timeout: 276 seconds]
Guest72431 is now known as notzmv
ur5us_ has joined #zig
notzmv has quit [Read error: Connection reset by peer]
notzmv has joined #zig
ur5us_ has quit [Ping timeout: 250 seconds]
codingstream has quit [Ping timeout: 246 seconds]
dyeplexer has joined #zig
lonjil has quit [Quit: No Ping reply in 180 seconds.]
lonjil has joined #zig
klltkr has joined #zig
Amun_Ra has quit [Quit: Gdyby mi się chciało tak jak mi się nie chce…]
Amun_Ra has joined #zig
<klltkr> I've just been informed that zig is apparently a dead end: :)
<fengb> “maisiliym: Creator of sajban - Li suffers from an intolerence to idiocy. Therefore, he does not address people, only ideas. Hence, any bad feelings are unwarranted.”
<fengb> lol
<klltkr> :D
jokoon has quit [Quit: Leaving]
<ifreund> wait, this is another wayland compositor I didn't know about?;2;13~
<klltkr> Not a very good one!
<ifreund> klltkr: your project? Not using wlroots is a bold sep
<klltkr> Yeah, my project
<ifreund> and you've even got your own scanner, neat
<klltkr> I suspect I'll give up at some point and use wlroots if I continue on. Years ago I started a Common Lisp compositor, the ulubis mentioned in our friend's issue (, that was pre-wlroots so I already knew the steps required to get very basic drm/kms stuff working
<ifreund> well, if you're not aware I maintain idiomatic zig wlroots and libwayland bindings, might be worth checking out
<ifreund> I'm curious to figure out what choices you made with your scanner though
<klltkr> I'm happy to answer any questions
<ifreund> oh damn, you have your own wayland protocol implemenation as well
<klltkr> I've always felt that the wlroots stuff couples too many things together. To me the backend stuff should be a separate library (i.e. a toolkit for rendering and input handling that targets X11 / Wayland and DRM) and that could be quite separate from code that simplifies the wayland bits
<klltkr> Yeah, I was basically experimenting with a "pure" (you can't get that pure, i.e. static binary, because you will always end up needing OpenGL)
<ifreund> I don't disagree, I've toyed with the idea of rewriting the "wayland bits" in zig with a pure-zig wayland implemenation while still using the backend parts of wlroots
<ifreund> yeah linking mesa is always the issue :/
<klltkr> You could in theory do a pure compositor if you implemented all of libdrm (or at least enough to get pageflips) and libgbm to get pixel buffer into which to draw
<klltkr> *pure software compostior
<ifreund> which would be awesome, but ultimately not very usable for the typical modern desktop
<klltkr> It would be an interesting exercise
<klltkr> Yeah
<klltkr> I might take another look at wlroots and see if I can just extract the backend bits
<ifreund> klltkr: I'm pretty sure wlroots is modular enough that you can choose not to use the wayland protocol bits
<ifreund> romangg is doing exactly this for KwinFT currently
<klltkr> It'll still make me use wl_list though won't it :D
<ifreund> klltkr: I have a nice wrapper though!
<klltkr> Nice
<ifreund> this will be updated to use std.meta.FieldEnum() when 0.8.0 releases, which will be a bit cleaner still
<klltkr> I'm not familiar with std.meta.FieldEnum()
<ifreund> it gives you an enum with variants for every field of a struct, which would mean list.Head() could take that enum instead of the field name as a string
<klltkr> Ah cool
<Nypsie> klltkr: Nice wasm interpreter you got there as well :)
<klltkr> Sometimes I wonder if Wayland needs a single server implementation, let's call it X12 for arguments sake, and it simply provides a special-cased window manager protocol that forwards on messages to a manager client. Save everyone reimplementing all of this behaviour over and over again, and as side benefit decouple stuff so it that e.g. the window manager can crash and be restarted without losing the entire session. At the end of the day I want to draw
<klltkr> some silly effects on screen and play around with user interaction but get caught up in understanding how everything works
<ifreund> klltkr: I think wlroots goes a long ways towards simplifying the job for server authors and reducing code-duplication. A fully-featured window manager protocol has the disadvantage of increasing the number of round-trips required to display things on the screen, I don't think anyone's given it a very serious attempt yet.
<companion_cube> just someone please rewrite a modern X server :/
<ifreund> I do have a layout protocol for my compositor that allows a select client to determine the layout of the views on the screen
<ifreund> companion_cube: nah, the server's not the only problem, the protocol sucks too
<companion_cube> maybe with a new codebase it'd even be possible to improve the protocol without throwing 40 years worth of code out the window
<companion_cube> (just realized yesterday that yet another thing I use, `dot -Txlib`… uses X)
<klltkr> ifreund: yeah, you'd end up chatting more on the protocol but the messaging I don't think is the bottleneck and the latency for unix domain socket will be what, some tiny fraction of your 16 ms render budget
<klltkr> ifreund: a layout protocol sounds interesting
<ifreund> it's very centered around dwm-esque dynamic tiling, but it's as efficient in terms of round-trips as leon-p and I were able to get it
<klltkr> companion_cube: yeah, Wayland is definitely correct (in my opinion) in what it does and what it fixes. My feeling is that people have issues with Wayland because each compositor is essentially a reimplementation of a bunch of core functionality and then people get upset because they can't copy and paste. wlroots attempts to tackle that by providing a library, where I'm starting to think a single implementation of a server that environments / managers
<klltkr> can hook into to might be cool (and give you that cool thing where you can write (an incredibly basic) X11 window manager in a few dozen lines of code)
<klltkr> Nypsie: thank you! It's currently broken on the latest 0.8.0; my goal for the day is fixing that
<mq32> klltkr: how usable is it already?
<companion_cube> klltkr: it's a long debate I guess.
<companion_cube> it's kind of sad people are ok with throwing away X, but not stuff like posix, which is much worse
<ifreund> posix is also much harder to throw away than X
<ifreund> like I'd be all over that if I saw a reasonable way to do so
<klltkr> mq32: I think (can't say 100% for sure) that it will run any MVP (i.e. the base specification without any of the extensions). I.e. I think I'm correctly implementing all of the opcodes in that almost all of the official testsuite stuff passes for execution. What I don't have implemented fully is the validation step
<fengb> How is posix much worse than X?
<ifreund> I for one don't think it is, I think posix isn't great but X is a lot worse
<mq32> klltkr: okay, cool. so i can run zig programs? *grin*
<klltkr> mq32: I would love to know if you could!
<mq32> hmm
* mq32 writes foxwren on the list of deps for dunstwolke *grin*
<klltkr> As I say, it's currently broken on the latest 0.8.0, but if you've got the version used in laying around you might get something working
<mq32> what's broken?
<klltkr> mq32 I was allocating arraylists with the arena allocator and being a but naught by holding onto previously allocated chunks, with the change it seems like those old chunks are being overwritten with 0xaa (which is good but it means I need to make it correct!)
<klltkr> I was trying to do a bit of refactoring to see if I could get the same optimisation andrewrk got in (i.e. getting a branch prediction slot for each op instead of a single jump point and jumping directly)
<klltkr> Because it's pretty slow at the moment
<klltkr> mq32 what is dunstwolke?
<mq32> an experimental OS of mine
<klltkr> Nice
<mq32> at least, that's the final goal
<mq32> and i require all apps to be run in wasm as they should be movable in-flight between nodes
<klltkr> It's funny that you say that because I was thinking of trying to stick it in a basic OS and also stick it in a Wayland compositor :)
<mq32> and that requires stuff like wasm
<klltkr> Interesting
<mq32> where memory is allocated in a very controlled manner
<ifreund> dunstwolke is an OS now? neat
<mq32> ifreund: it always was!
<mq32> dunstblick is the UI system
<ifreund> so distributed OS thing?
<mq32> but there are a lot of components i'm thinking about ^^
<mq32> yeah
<mq32> distributed everything, ad-hoc (known-)device inclusion
<mq32> i'm reworking the dunstblick frontend right now to be able to be used as a standalone desktop thingy (using DRM)
<mq32> making it as minimal as possible
<marler8997> what is std/x ?
<mq32> experimental new APIs
<marler8997> ah, thanks
<mq32> marler8997: to be pedantic:
<mq32> udp and tcp addresses actually differ
<marler8997> they do?
<mq32> semantically, yes
<mq32> but they have the exact same layout
<mq32> udp port 300 is not tcp port 300
<mq32> so UdpAddress { .ip = "", port = 5 } is not TcpAddress { .ip = "", port = 5 }
<mq32> tcp will never use the udp address
<marler8997> that's not what I mean by equivalence here
<mq32> but: that's pedantic
<mq32> i would also use the same type :D
<marler8997> both udp and tcp are built on top of the IP protocol
<mq32> yes
<mq32> and both udp and tcp contain a "port: u16" field :D
<marler8997> you could implement udp/tcp on top of other transports as well
<mq32> no, you can't *rofl*
<marler8997> oh?
<mq32> checksums are defined with inclusion of a ip header
<marler8997> why's that?
<marler8997> you could implement it over serial for example
<mq32> bad design
<marler8997> why bad design?
pretty_dumm_guy has joined #zig
pretty_dumm_guy has quit [Client Quit]
<marler8997> the address of a udp packet/tcp packet is not apart of the udp/tcp protocol, it's apart of the IP protocol
<mq32> because the checksum requires the existence of an IP header
<marler8997> of which udp and tcp share
<mq32> i know
<marler8997> so why would you have 2 implementations of the Address type for udp/tcp?
<mq32> but the checksum field in the header depends on the source and destination address of the IP header
<mq32> as said: i wouldn't, i'm just being pedantic
pretty_dumm_guy has joined #zig
dyeplexer has quit [Ping timeout: 246 seconds]
<marler8997> well I'm curious what you're being pedantic about now
<marler8997> :)
<marler8997> not sure I quite understand
<mq32> the port in the address field is actually union {udp_port:u16, tcp_port: u16}
<mq32> that's all :D
<mq32> (so the port itself is encoded the same way for udp/tcp, but they have different semantics)
<marler8997> I mean, you bring up an interesting point but I'm not sure I agree with that perspective yet
<mq32> i mean
<mq32> it doesn't matter in the type system
<mq32> it's just something one should be aware of that the port is actually not part of a machine address
<mq32> but of a protocol address
<marler8997> couldn't you just as easily say it is the ip that is different, and the port is the same?
<marler8997> why say it's the port that differs rather than the ip?
<mq32> my point is that a (binary) equivalent address is missing the information what protocol it is for
<marler8997> is it though?
<mq32> so if i tell you "connect to", you cannot do that without knowning if you need to use tcp or udp
<marler8997> I'm not sure what you mean by "connect to", it sounds like you're talking about implementation details?
<mq32> no, i'm talking about semantics
<marler8997> you could send an IP packet to
<mq32> no, you can not
<marler8997> why not?
<mq32> because an IP packet doesn't have a port
<mq32> a UDP packet or a TCP packet have a port
<marler8997> ah
<mq32> an ICMP packet only has an IP header, but no port information
<mq32> so if i tell you "send 5 bytes to", you have to ask: what protocol?
<mq32> :D
<marler8997> gotcha, now I see what you're saying, I forgot the port was part of the udp/tcp header
<mq32> and the same goes for sockaddr_in
<mq32> but: doesn't really matter for practical APIs
<marler8997> I suppose I forgot because of my familiarity with sockaddr_in, since it combines both the ipaddr/port
<mq32> yeah
<marler8997> good discussion, pedantic's confirmed
<mq32> hehe
<marler8997> still have the question about using tcp outside of ip
<marler8997> you were saying that's bad design?
<marler8997> some googling reveals there is tcp over ipx (, however, I'm not familiar with ipx
Akuli has joined #zig
dyeplexer has joined #zig
<fengb> I have not heard of IPX for a long time
<marler8997> weird, it's like a poor man's version of ip
dyeplexer has quit [Ping timeout: 276 seconds]
dyeplexer has joined #zig
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
zenkuro has quit [Ping timeout: 246 seconds]
zenkuro has joined #zig
xackus has joined #zig
cole-h has joined #zig
tlam has joined #zig
klltkr has quit [Quit: Textual IRC Client:]
klltkr has joined #zig
leon-p has joined #zig
zenkuro has quit [Ping timeout: 240 seconds]
pretty_dumm_guy has joined #zig
Akuli has quit [*.net *.split]
tlam has quit [*.net *.split]
earnestly has quit [*.net *.split]
gpanders has quit [*.net *.split]
andrewrk has quit [*.net *.split]
ifreund has quit [*.net *.split]
terinjokes has quit [*.net *.split]
Ekho has quit [*.net *.split]
earnestly has joined #zig
Akuli has joined #zig
gpanders has joined #zig
tlam has joined #zig
andrewrk has joined #zig
terinjokes has joined #zig
ifreund has joined #zig
gpanders has quit [Max SendQ exceeded]
gpanders has joined #zig
Ekho has joined #zig
B767B_ has joined #zig
dyeplexer has quit [Remote host closed the connection]
<B767B_> hello :-)
<B767B_> I am a new to zig (started learning this week) and so far I love it :-)
<Nypsie> Welcome :)
<B767B_> Never enjoyed programming as much since Turbo Pascal 6.0 :-D
<B767B_> I got a very simple problem though: how can I read keypresses from a terminal (Linux/bash)? Maybe I am too stupid to google correctly for it...
<andrewrk> it's a bit of a tricky problem, very difficult to do portably
<B767B_> I am fine if I get it runnning on linux for the moment. If possible at all.
isolier has joined #zig
<andrewrk> I don't remember what the options are for doing this, but I bet someone else here does
<andrewrk> here's a project that might provide some inspiration, it does terminal stuff
<Nypsie> Do you want to read them individually?
<B767B_> Yes, individually. I am implementing a CPU emulator and want add a REPL for it.
<Nypsie> In that case you need to set the termattributes
<Nypsie> Specifically, the VMIN and VTIME, which will return you the result per given msec, rather than on \n
<B767B_> I found but was not able to compile as described...
<Nypsie> Maybe a more zig example can help you:
<Nypsie> Oh, I just realized the link you gave is Zig as well haha
<Nypsie> Anyway, that example requires you to link libc, which mine doesn't
<B767B_> That sounds like a big plus not to have to link libc.
<Nypsie> There's some touchups that the example could use, such as resetting the original termattributes on error using errdefer, but I suppose it gets the general idea accross :)
<B767B_> I'll try your code. Thanks a lot :-)
<Nypsie> You're welcome
<B767B_> Nice! A little vi
<B767B_> Compiles and runs.
vent has quit [Quit: ZNC -]
sord937 has quit [Quit: sord937]
<andrewrk> fengb, thanks for the heads up, looking...
<andrewrk> it looks synced up to the web page to me
<andrewrk> oh both are behind. I see
[wtf] has quit [Ping timeout: 246 seconds]
<andrewrk> I'm on it
jeang3nie has joined #zig
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
<fengb> ,
B767B_ has quit [Ping timeout: 240 seconds]
aigoo has quit [Ping timeout: 276 seconds]
aigoo has joined #zig
B767B has joined #zig
marler8997 has quit [Ping timeout: 268 seconds]
Akuli has quit [Quit: Leaving]
<andrewrk> fengb, fixed
<mq32> andrewrk: result location in stage 1 is really broken :D
jeang3nie has quit [Quit: Quit]
<klltkr> mq32, I fixed the issues with foxwren on the latest 0.8.0 (see
<andrewrk> mq32, indeed
<mq32> noice!
<mq32> andrewrk: took me half the evening tracking down that bug
<andrewrk> that's why I took extra care to code it squeaky clean in stage2
<fengb> Thanks!
<mq32> i thought so :)
<mq32> stage2 is code that is written with the knowledge of how to reach the goal
<mq32> but: I'm using this MMIO wrapper now and it's pretty great
<mq32> i am likely to revoke my views on volatile and could just live with @volatileLoad and @volatileStore
<andrewrk> that's interesting to know
<andrewrk> there are a lot of edge cases having to do with volatile as a pointer attribute
<mq32> ↑ see my bug report :D
<blueberrypie> i just found out my employer has preapproved donation matching for zig software foundation. noice. bye gh sponsors
<mq32> cool
<andrewrk> sweet! thanks blueberrypie
<andrewrk> we should probably announce in the release notes that this may newly be available to various employers
<g-w1> why newly available? because of the zsf?
<blueberrypie> i'm not sure how it works but my employer uses benevity for managing gift matching. I assume that other employers who use benevity will also support matching donations as well
<g-w1> ahh i see
codingstream has joined #zig
codingstream has quit [Quit: WeeChat 3.0.1]
codingstream has joined #zig
<andrewrk> yeah it's because we signed up for benevity and did all their paperwork
<andrewrk> had to drive to the bank and get some stupid paper form for that
B767B has quit [Remote host closed the connection]
B767B has joined #zig
B767B has quit [Remote host closed the connection]
marler8997 has joined #zig