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/
ofelas has quit [Ping timeout: 260 seconds]
ofelas has joined #zig
ziggypop has quit [Ping timeout: 245 seconds]
layneson has joined #zig
layneson has quit [Ping timeout: 240 seconds]
dimenus has joined #zig
haliucin1s has quit [Read error: Connection reset by peer]
haliucinas has joined #zig
ur5us has quit [Ping timeout: 256 seconds]
ur5us has joined #zig
aarvay has quit [Quit: Connection closed for inactivity]
waleee-cl has quit [Quit: Connection closed for inactivity]
layneson has joined #zig
layneson has quit [Ping timeout: 258 seconds]
stripedpajamas has joined #zig
dimenus has quit [Read error: Connection reset by peer]
scriptdevil has joined #zig
scriptdevil has quit [Ping timeout: 260 seconds]
ur5us has quit [Ping timeout: 260 seconds]
_ofelas has joined #zig
ofelas has quit [Ping timeout: 256 seconds]
marnix has joined #zig
marnix has quit [Ping timeout: 260 seconds]
dermetfan has joined #zig
stripedpajamas has quit [Quit: sleeping...]
_Vi has joined #zig
craigo has joined #zig
cole-h has quit [Quit: Goodbye]
_Vi has quit [Ping timeout: 272 seconds]
marnix has joined #zig
ur5us has joined #zig
marnix has quit [Ping timeout: 264 seconds]
cren has joined #zig
_Vi has joined #zig
opDispatch has quit [Quit: Konversation terminated!]
corvid has quit [*.net *.split]
swills_ has quit [*.net *.split]
lemmi has quit [*.net *.split]
mmx870 has quit [*.net *.split]
corvid has joined #zig
mmx870 has joined #zig
lemmi has joined #zig
swills_ has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
marnix has joined #zig
marnix has quit [Ping timeout: 246 seconds]
layneson has joined #zig
gruebite has joined #zig
marnix has joined #zig
layneson has quit [Ping timeout: 256 seconds]
aarvay has joined #zig
<Ashpool> What is the recommended way to output a long formatted string (e.g. read via @embedFile)? std.fmt.format() refuses to process anything longer than 331 chars (this exceeds 1000 backwards branches), but setting eval branch quota to arbitrarily large value doesn't seem like a good idea to me.
<Ashpool> I wouldn't mind processing it in the runtime, since it would need to happen rarely.
<daurnimator> Ashpool: essentially... you'll need to pump the eval branch quota
<daurnimator> Ashpool: bumping to some multiple of your string length would be reasonable I think
<Ashpool> daurnimator, could this have any compile speed implications, in theory?
<daurnimator> Ashpool: @setEvalBranchQuota is a blunt tool to avoid the halting problem
<Ashpool> I see
marnix has quit [Ping timeout: 246 seconds]
marnix has joined #zig
<alva> Sorry, wrong channel
waleee-cl has joined #zig
Shucks has joined #zig
Shucks has quit [Quit: Leaving]
Ristovski has joined #zig
marnix has quit [Ping timeout: 240 seconds]
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
marnix has joined #zig
xackus has joined #zig
marnix has quit [Ping timeout: 240 seconds]
pangey has quit [Quit: bye]
pangey has joined #zig
marnix has joined #zig
dermetfan has quit [Ping timeout: 272 seconds]
<andrewrk> Ashpool, use "{}" and put the string as a parameter
Guest61109 has joined #zig
<Guest61109> Hi all. I'm trying to find a link I saw a few months ago. It was a list/table comparing C, Rust, Zig, and handful of other language on some metric that I can't remember. I think it was which tools you needed to bootstrap the compiler from source?
<Guest61109> I think the use-case is something like "in the future you have a copy of the language source code and zero binaries, how hard is it to get up and running" maybe? I think Zig came out on top but I really don't remember. Maybe it had to do with cross-compiling? Hopefully someone knows what webpage I'm talking about
mipri has joined #zig
<andrewrk> Guest61109, I haven't seen this before, would be interested if you find it
KKRT has joined #zig
Guest61109 has quit [Quit: WeeChat 2.9]
<Sahnvour> andrewrk: are there any guarantees about the values of unused bits in integers of various sizes (say, i53) ? ie. can we assume that if a i53 variable is not undefined, all its unused bits will for example equal 0 ?
xackus has quit [Ping timeout: 240 seconds]
xackus has joined #zig
<andrewrk> Sahnvour, no, those bits have undefined values
<andrewrk> I'm sorry, I answered for structs. Let me think about it for integers a bit longer
<Sahnvour> I'd expect the same for ints, as that would save a few instructions here and there
christianbundy1 has joined #zig
<christianbundy1> Sorry, having nick issues. :~)
<andrewrk> when you say unused bits, you mean the difference between @sizeOf(T) * 8 and @typeInfo(T).Int.bits right?
<Sahnvour> yes
<christianbundy1> andrewrk: Will do! The closest I've found is http://bootstrappable.org but now I'm wondering if I'm misremembering the metric.
<Sahnvour> to clarify, I'm writing a trait that will tell if a type has a unique representation in bits for each of its possible values
<andrewrk> Sahnvour, I belive the answer is they are guaranteed to be 0 but I want to wait to stabilize that until later
<Sahnvour> okay, thanks
<danyspin97> it's hard to build zig from source using c++ :(
<danyspin97> can the master version be built using zig?
<leeward> danyspin97: not yet, and on what platform are you trying to build it?
<andrewrk> we're not shipping self-hosted yet
<danyspin97> leeward: x86-64-musl
<andrewrk> but even when we are, the build process will involve making the c++ compiler and using that to build self-hosted
<danyspin97> I have zig-0.5 working
<leeward> danyspin97: Linux? FreeBSD? Windows?
<pixelherodev> Presumably Linux
<pixelherodev> I don't think musl supports anything else
<danyspin97> but zig-0.6 and zig-master don't want to build using system llvm/clang
<danyspin97> yup, Linux
<leeward> Freestanding zig would be amusing.
<fengb> Boot to zig
<ifreund> we gotta make a zig version of that python os
<pixelherodev> Freestanding Zig is almost possible
<pixelherodev> You can integrate stage2 with e.g. a multiboot header, VGA driver, PS/2 driver, and have a basic Zig REPL
<leeward> danyspin97: What distro? Does it have llvm10?
<andrewrk> danyspin97, so far the clues we have are: "hard to build" and "zig don't want to build" - if you give actual error messages it would go a long way to getting help
<danyspin97> leeward: Exherbo. Yea it does have llvm10. I was bumping the package to 0.6.0 and fixing building master version
cole-h has joined #zig
<danyspin97> andrewrk: the error is documented here: https://github.com/ziglang/zig/wiki/Troubleshooting-Build-Issues#gentoo
<andrewrk> I suggest to build llvm/clang/lld from source
<andrewrk> maybe with version 11 they will have these issues resolved
<danyspin97> was specifically asking if it was possible to build using zig for this reason
<danyspin97> I understand most problems comes from llvm/clang and not from zig :)
<pixelherodev> See, this is the kind of thing I point to when I say stage2 should actively encourage *not* using LLVM
<danyspin97> andrewrk: I cannot put those in the package, unfortunately :( I'll just wait for clang-10.0.1 before bumping the package
<danyspin97> (referring to building llvm/clang/lld from source)
<andrewrk> danyspin97, sorry - we get a lot of this kind of problems and it's frustrating that llvm regressed in this way from 9 to 10, I see you know what you're doing
<danyspin97> no need to be sorry :)
<andrewrk> I had this bug reported on the tracker right after 10.0.0rc1 but they decided to release without fixing it
cren has quit [Ping timeout: 265 seconds]
decentpenguin has joined #zig
dermetfan has joined #zig
<Sahnvour> I can't find the flag to set zig's stdlib path anymore, is it still around ?
<ifreund> Sahnvour: --override-lib-dir on 0.6.0 at least
<Sahnvour> ah right, thanks
christianbundy1 is now known as christianbundy
<christianbundy> On second thought, maybe it was about cross-compiling Zig/Rust/C/etc to bare metal and which dependencies you'd need? I think I remember Rust being good in theory but difficult in practice because most libraries depend on stdlib.
<ifreund> sounds about right
<ifreund> not linking libc by default is a big strength of zig
<companion_cube> christianbundy: do you mean libc or stdlib?
<ifreund> companion_cube: rust std depends on libc
<companion_cube> ah, I see.
<companion_cube> for IO and malloc, I imagine…
<ifreund> (zig's doesn't)
<companion_cube> except on macOs, doesn't it?
<christianbundy> companion_cube: could have been libc, my memory of it is very hazy
<ifreund> yeah rust stdlib doesn't make any syscalls directly
<ifreund> it all goes through
<companion_cube> guess it was simpler
<ifreund> *through libc
<andrewrk> lazy decl analysis has some downsides but using std lib in freestanding is one of the upsides
<ifreund> well, from what I heard there were a few attempts to get rid of the libc dependency for rust std, but from what I can tell they saw little to no success
<companion_cube> they probably have a lot of other priorities, like generating better llvm IR :D
<leeward> Doesn't core not depend on libc?
<ifreund> leeward: yes, that's right
<leeward> Well, if sealed rust is ever going to go anywhere they'll have to get it done.
<companion_cube> no_std in rust doesn't depend on anything
<ifreund> core cant do allocation or I/O though
<leeward> And if sealed rust isn't going to go anywhere, I can forget everything I've learned about Rust.
<companion_cube> well if you use no-std it means you're writing your OS, or targetting wasm
<companion_cube> so, you have to do IO your own way anyway
<pixelherodev> Not really
<pixelherodev> With Zig, you can hook up stdlib to I/O and allocation and everything really easily
<pixelherodev> I set it up so that `std.io.getStdOut().stream` wrote directly to the VGA driver
<pixelherodev> Without needing to tweak the stdlib *at all*
<companion_cube> you still need to define IOs, but yes
<pixelherodev> Which means e.g. std.debug.warn worked without any changes
<pixelherodev> leeward: sealed rust?
<christianbundy> (I don't know if everyone already saw this, but I'm looking for a webpage I lost which used a similar metric (cross-compiling to bare metal, maybe?) and compared a handful of interesting programming languages.)
<leeward> pixelherodev: Rust for safety critical applications.
<ifreund> yeah zig's std is designed to make it easy to BYOOS (Bring Your Own Operating System)
<leeward> companion_cube: That's the one. I've talked to some folks at Ferrous, and they're still working on it. I don't expect to see it in actual uses for at least a few years though.
<companion_cube> this stuff always takes time…
<leeward> Yeah, the FDA doesn't necessarily see innovation in how we develop our safety-critical systems as a good thing. I can't blame them.
<companion_cube> the FDA?! hu
<leeward> I certainly wouldn't want to be the first one to submit an application that says "These systems don't interact because the language guarantees it."
<companion_cube> surely Ada must have similar claism
<companion_cube> claims*
<pixelherodev> Yeah, I'd think so...
<pixelherodev> I'd hate to be the one to have to verify the compiler lol
<leeward> FDA, EMA, whoever.
<leeward> Ada doesn't have a borrow checker.
<leeward> It's got lots of stuff in its safety story, but not "these processes can't interact because the compiler said so."
<companion_cube> I think compcert got certified for avionics
<companion_cube> _with optimizations_
<andrewrk> stage2 progress: https://clbin.com/Gvfat
<andrewrk> this is simple register allocation. note the 2 movs at 8000029 and 8000035. it has to allocate the rax register because the operands live a long time
<andrewrk> importantly, it knows it can re-use rax for both movs
<companion_cube> the pile of yacks from that to groovebasin is pretty deep, andrewrk :p
<andrewrk> eh I'm only 31 years old, I've got time
<leeward> andrewrk: That is leaps and bounds ahead of the last time I looked. Nice!
shakesoda has joined #zig
<leeward> companion_cube: There are lots of certified compilers. Some of them are even decent.
<companion_cube> as far as I understood, only compcert was certified to run with optimizations :)
<leeward> I wouldn't know about avionics.
wilsonk has quit [Ping timeout: 256 seconds]
<leeward> The thing I care about is -Os though.
Akuli has joined #zig
wilsonk has joined #zig
cren has joined #zig
yeti has quit [Remote host closed the connection]
craigo has quit [Ping timeout: 258 seconds]
yeti has joined #zig
<christianbundy> andrewrk: FOUND IT! https://cancel.fm/blog/2019-11/language-fragility/
<fengb> "Ripcord is shareware." there's a word I have no heard for a long time
<leeward> Shareware's still a thing?
<leeward> christianbundy: nifty
<companion_cube> "if the internet stopped functioning"
<companion_cube> well, I wouldn't have an OS then…
<companion_cube> -_-
<christianbundy> companion_cube: do you use ChromeOS? :~)
<leeward> Yeah, I'm not sure why "no Internet" means I can't have libc.
swills_ is now known as swills
<christianbundy> I read that as "you have to get the compiler working on another computer but you can't download anything"
<companion_cube> christianbundy: no, but I wouldn't get upgrades anymore
<companion_cube> christianbundy: you'd still have libc
<leeward> It says "can you copy the compiled program to another computer and expect it to work," which...only if the "another computer" is running the same stuff anyway.
FireFox317 has joined #zig
<companion_cube> ah well, musl exists for a reason…
<leeward> One reason: monoculture is bad.
<companion_cube> I hear some OSes won't let you talk to them without libc anyway
<companion_cube> linux being more of an exception in that
<FireFox317> andrewrk, why does the add function contains the syscall/int3 ? I see it is after the 'ret' so i assume it is just extra bytes. Is it just luck that these bytes are now syscall/int3?
stripedpajamas has joined #zig
marnix has quit [Ping timeout: 246 seconds]
<andrewrk> FireFox317, everything after `ret` is garbage bytes. I'm not sure why objdump shows it since the symbol table correctly says that it ends at 0x8000058: https://clbin.com/Wrm5r
cren has quit [Ping timeout: 256 seconds]
<andrewrk> the reason the functions have garbage bytes there is room for functions to grow when they are edited for incremental compilation purposes, so that it won't have to move the function body somewhere else in the ELF file
marnix has joined #zig
<andrewrk> christianbundy, wow, I feel like someone is finally apprecating this aspect of zig that I have put a lot of effort on but it's difficult to point out or explain
marnix has quit [Read error: Connection reset by peer]
<oats> why is go on that list as OK?
<oats> I want to say sometimes I've compiled a go program and the binary suddenly links to libc for some reason
<companion_cube> (uh, I wonder: are pthreads managed via system calls on linux?)
stripedpajamas has quit [Quit: sleeping...]
<christianbundy> andrewrk: are there any resources you'd recommend looking at to appreciate it more completely? A rant would also be very welcome if you have time/energy/interest
<christianbundy> I'm new to low-level languages, so my analysis is lots of "oh cool Zig has a green check mark next to it on someone's webpage!"
FireFox317 has quit [Ping timeout: 240 seconds]
<oats> hehe
<oats> christianbundy: in relation to cross-compilation/portability things?
factormystic has quit [Ping timeout: 256 seconds]
<oats> have you seen this?
<oats> kind of along those lines, good read
FireFox317 has joined #zig
<Akuli> i see that the python way to implement hash tables has been implemented and is on master :D
rzezeski has quit [Quit: Connection closed for inactivity]
<christianbundy> oats: yeah, I was really impressed by that. how does Zig make cross-compiling so easy when langs like Rust crash and burn?
<christianbundy> I had to spend *hours* trying to build my tiny rust program for a friend on macOS using osxcross/etc, why don't I have to do that with Zig?!
FireFox317 has quit [Ping timeout: 240 seconds]
<leeward> christianbundy: It's all about priorities.
<companion_cube> I think in rust it's one `rustup` away, but I never tried, so 🤷
<oats> eh, rust isn't terrible, it's just a bit more fiddly
<oats> imo, anyways :P
<andrewrk> to be fair macos is the most difficult cross compilation target
marnix has joined #zig
marnix has quit [Ping timeout: 240 seconds]
ur5us has joined #zig
<leeward> Why is that? It's a first class target for LLVM.
<andrewrk> a bunch of reasons. frameworks, sloppy license annotations of their libc header files, non-ELF based object files, application signing, and some others I'm forgetting
<leeward> Oh, macos doesn't use ELF? What the heck?
<leeward> I thought Darwin was a freebsd fork.
decentpenguin has quit [Quit: decentpenguin]
<shakesoda> macos is mach-o isn't it
<fengb> The Rust compiler they ship isn't "complete" and anything additional requires rustup which is super fiddly
<fengb> One thing I really liked about Zig is that it's one binary for all the targets
_Vi has quit [Ping timeout: 272 seconds]
<leeward> It is a nice feature. Getting Zig code to build for ARM is the easiest time I've ever had with a cross compiler.
<ifreund> man, that website just reminded me that they recommend piping curl into bash as an installation method
<leeward> curl http://www.sketchy.com/weirdfile.sh | sudo bash
<leeward> Installation method of champions.
<leeward> Bonus points if the server decides what file to serve based on the UA string.
christianbundy has quit [Ping timeout: 260 seconds]
<oats> that will either prompt me to nope out and scour package repos, or pipe it to a file and read it first
<andrewrk> it's weird to me that "sudo" is involved in any installation
<leeward> It seems appropriate for installing anything system-wide.
<shakesoda> how often do you actually give a crap that something is installed system wide
<shakesoda> for me the answer is "not actually that often"
<leeward> Every time I use aptitude.
<companion_cube> I mean, `yay -S rustup` and then it's all in userland
<andrewrk> sorry to be clear I mean in any installation when you download software from a web browser as opposed to a package manager
<shakesoda> i explicitly avoid dealing with system packages whenever i can
<leeward> Oh, yeah, no way do I want to download something with a web browser and install it with root.
<ifreund> uh, the only thing worse than package managers is not having one
<leeward> ifreund: seconded
<leeward> See also: Windows.
<companion_cube> ifreund: +1
<ifreund> side-steping it makes things worse
<andrewrk> side-stepping it with root makes things worse. side stepping it with user-local stuff is the right solution IMO
<shakesoda> package managers for anything that doesn't actually *need* to be system wide is usually worse than not
<shakesoda> i hate them quite deeply
xackus has quit [Ping timeout: 240 seconds]
<ifreund> yeah they should strictly be for system-wide stuff, I agree that sidestepping for user-local stuff is the way to go
<shakesoda> i think fedora silverblue has a pretty good idea going on for packaging, with ostree for all the system stuff
<leeward> I for one really like the large army of volunteers who make sure that my software works on my system, and who manage security updates for me.
<shakesoda> flatpak is kind of a pain in the butt, but in that setup user-local is the default and nothing can really possibly screw my system up without going *far* out of my way to make it
<shakesoda> silverblue unfortunately also causes me a lot of grief elsewhere so it isn't my daily driver, but i think they have the right idea going on :(
<ifreund> flatpak is horrible, the only vaild use-case is for proprietary software which is also horrible
<shakesoda> i'm not ideologically opposed to proprietary software
<shakesoda> more indifferent
<ifreund> fair enough, I won't tell you what to believe
<shakesoda> what's really awful about flatpak to me is just how painful it is to deal with
<shakesoda> packaging anything for it sucks
<shakesoda> making things talk to each other with it sucks
<shakesoda> dealing with graphics with it sucks (doubly so on nvidia, which also sucks)
<shakesoda> in practice i just want easy updates for appimages... or to just use an older version of macos
<BaroqueLarouche> The first game I've worked at Tribute Games I had a Linux version working but we didn't want to support it because of how Linux is fragmented.
<shakesoda> every single one of my games supports linux very well, and i develop them a lot on linux. i do not ship for linux.
<BaroqueLarouche> not worth the effort for the small userbase
<BaroqueLarouche> IMO
<andrewrk> one of my goals with the zig ecosystem (eventually) is to improve it enough that game developers find it easy to support linux
<shakesoda> it's a *lot* less trouble to support people just running in wine/proton
<shakesoda> i'm less than proud of that, suffice to say
<shakesoda> andrewrk: a noble goal
<mipri> sad example of that is Wasteland 2 on Steam. it ships a Linux version but I couldn't get the sound to work. configure Steam to use proton with the Windows version - working sound.
<andrewrk> i'm talking static binary that works on *all* linux distros
<shakesoda> well, usually the binary working isn't specifically what goes wrong
<shakesoda> barring glibc crap
<andrewrk> what goes wrong besides audio?
<companion_cube> andrewrk: still requires that people use openGL rather than direct3D, right?
<leeward> Basically all the games I play support Linux as a first class target. Unity helped a lot there.
<andrewrk> companion_cube, vulkan
<BaroqueLarouche> openGL is too old and fragmented
<shakesoda> you can also use one of those d3d on vulkan things to write for d3d on linux if you want
<BaroqueLarouche> I'm sad that Vulkan also does extensions similar to OpenGL
<shakesoda> BaroqueLarouche: it's also usually the only choice
<shakesoda> vulkan is upsetting to deal with in general
<BaroqueLarouche> yeah
<BaroqueLarouche> well every 3D API that I know of (public and under NDA) is moving to a low-level Metal/Vulkan/D3D12 model so we can't avoid it :(
<shakesoda> i'd really just rather write gl4.3+ or d3d11
<BaroqueLarouche> is moving or is
<shakesoda> i'm well aware of where things are heading, but where they are heading is a pain in the ass!
<ikskuh> BaroqueLarouche: i don't think that's a bad thing
<BaroqueLarouche> oh yeah
<shakesoda> i've been working on moving to vulkan, it's just a frustrating amount of work
<ikskuh> we should implement DX<12 and OpenGL in Vulkan/Metal/DX12
<ikskuh> as a userspace library
<shakesoda> d3d11 on vulkan as a userspace library is a thing
<ikskuh> yeah i know
<ikskuh> DxVk i think?
<ikskuh> would make stuff a lot easier
<ikskuh> you can also rely that OpenGL will behave the same on all platforms
<shakesoda> i definitely also would like gl over vulkan for that reason
<shakesoda> there's already some implementations, but they are far behind
<shakesoda> they essentially are meaningless to me until they have at minimum gles 3.1 or gl 4.3
<ikskuh> yeah, but we odn't have vulkan that long yet :D
<ikskuh> GL 4.5 is the "minimum" for me
<ikskuh> but mostly because GL_ARB_direct_state_access got core
<shakesoda> i can't get away with requiring dsa yet
<shakesoda> but i do require compute shaders
<ikskuh> huh, weird
<ikskuh> last time i checked DSA is available on all drivers with GL 3.3
<shakesoda> well, it's because of not having enough separation with gles
<shakesoda> (it wasn't me)
<ikskuh> ah
Akuli has quit [Remote host closed the connection]
st4ll1 has joined #zig
Ashpool has quit [Quit: Leaving]
KKRT has quit [Read error: Connection reset by peer]
dermetfan has quit [Ping timeout: 260 seconds]
Ashpool has joined #zig