<blinghound>
would this be something to create an issue over?
<andrewrk>
blinghound, sure, that's a good way to get some attention on your use case
gazler__ has joined #zig
<blinghound>
hi andrew! I'm a bit of a noob when it comes to contributing, but I'll create one
<blinghound>
I'm loving zig, thanks for your hard work.
gazler_ has quit [Ping timeout: 264 seconds]
<andrewrk>
glad you like it. as long as you can stand a few bumps here and there you're in for a fun ride :)
<blinghound>
I'm translating a 40,000+ line c++ project into zig, and it's been a night and day difference ;D
<blinghound>
I'll be releasing the source eventually
<blinghound>
once my income increases again I'll 100% be sponsoring
<andrewrk>
that's fun. you can probably start with translating pieces of it without having to translate the whole thing
<andrewrk>
if you are so inclined
<blinghound>
that's a good idea, I've got a lot of opengl code that could do with refactoring anyway
<blinghound>
so I can strip chunks out and link the zig code with the c++ project
<blinghound>
the user so has gotta be getting a lot of notifications
<leeward>
Fair warning: the generated .h files might not get you everything you want. You might have to tweak the interface to the Zig objects.
_whitelogger has joined #zig
blinghound has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 260 seconds]
ur5us has joined #zig
nephele_ has joined #zig
nephele has quit [Ping timeout: 260 seconds]
nephele_ is now known as nephele
_Vi has quit [Ping timeout: 260 seconds]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 256 seconds]
nikita_ has joined #zig
nikita` has quit [Ping timeout: 260 seconds]
riba has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
riba has quit [Ping timeout: 256 seconds]
<pmwhite>
Calling deinit on an ArenaAllocator frees everything of allocated, right?
<andrewrk>
right
<pmwhite>
Oh, oops, I was using the long-lived allocator, not the per-loop-iteration one.
_whitelogger has joined #zig
<pmwhite>
I guess it's also problematic if you make an ArenaAllocator from another ArenaAllocator
_whitelogger has joined #zig
B4s1l3 has joined #zig
B4s1l3 is now known as opDispatch
aerona has quit [Quit: Leaving]
cole-h has quit [Quit: Goodbye]
ur5us has quit [Ping timeout: 240 seconds]
Snetry has quit [Ping timeout: 240 seconds]
Snetry has joined #zig
gazler__ is now known as gazler
<daurnimator>
TIL of the subtraction linked list
<daurnimator>
which is notable because its can be relocatable
<daurnimator>
which also means serialisable
shinzo has quit [Quit: leaving]
tines9 has quit [Remote host closed the connection]
nikita_ is now known as nikita`
_Vi has joined #zig
_whitelogger has joined #zig
leeward has quit [Ping timeout: 264 seconds]
<pixelherodev>
mq32: good to know thanks
_Vi has quit [Ping timeout: 272 seconds]
dermetfan has joined #zig
ur5us has joined #zig
dddddd has quit [Ping timeout: 260 seconds]
<nikita`>
i was just wondering, is there a reason why zig does not support ternary expressions?
<nikita`>
new to this, coming from C
<zannzen[m]>
it's not needed, you can just use if statements in initialization...not sure if that's technically the reason or andrew just didn't like them :)
<zannzen[m]>
e.g. `const value = if (cond) then_value else other_value;`
<nikita`>
ah, okay. I know some people who don't like ternary expr, so I guess that's more readable to some.
<nikita`>
thanks
<mq32>
zannzen[m]: that's actually an if-expression
<mq32>
nikita`: the reason for "no ternary expression" is "not needed"
<mq32>
the if expression completly solves that use case in a more general way
<nikita`>
okay
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
_Vi has joined #zig
ask6155 has joined #zig
<ask6155>
Hello!
<ask6155>
How do I free slices?
<ifreund>
allocator.free(my_slice);'
<ask6155>
Also can someone give me some documentation of slices (I don't understand them)(from C land)
<ifreund>
they're basically just a special struct holding a pointer and a length
<ifreund>
something like struct{ ptr: [*]T, len: usize };
<shakesoda>
it happened: apple has announced that they're moving macs to arm
<shakesoda>
instead of this just being a rumor
<traviss>
looks like the array data isn't being cast appropriately in my example
<fengb>
They haven't announced arm though. RISCV has a chance!
<shakesoda>
they did, although they didn't say the word arm
<shakesoda>
just given they're showing stuff running on an A12Z, and we can already buy those
<fengb>
Oh good point
<fengb>
Could this mean macOS on iPad too?
<leeward>
shakesoda: Are they moving the whole line?
<mq32>
also top 500 is now lead by an ARM machine
<shakesoda>
yes, looks like it
<shakesoda>
fengb: probably not
<ifreund>
maybe iOS on macbooks
<leeward>
Well, that'll suck for cross-platform developers for a little while, but it's nice to finally have some diversity back in the PC market.
<fengb>
Death to hackintosh :(
<shakesoda>
fengb: well, not an immediate death at least
<mq32>
leeward: it makes apple development a lot easier
<mq32>
kinda
<shakesoda>
mq32: for sure
<mq32>
because everything will run on ARM now, so your applications are cross-compatible
<mq32>
also: hackintosh on RPI when?!
<fengb>
I'd expect them to lock down the specific ARM chip
<fengb>
Since they can now
<leeward>
mq32: Exclusive apple developers.
<mq32>
so? that's nothing new
<leeward>
Developers for just Apple: happy. Developers who have to support 3 platforms already: unhappy. Developers who dislike x86 and want it to die in a fire: less unhappy.
<ifreund>
yeah, i was gonna say that I've heard some "death to x86" sentiments in here
<fengb>
Hey just announced a compromise earlier today
<leeward>
traviss: seems unlikely. They plan WWDC a year in advance, and being sued over their app store monopsony is nothing new.
<leeward>
I wonder how this will affect Linux distros. Debian already has a fully supported ARM port. I wonder if we'll see ARMUbuntu.
waleee-cl has joined #zig
<leeward>
Maybe more options like Pinebook.
<fengb>
Archlinux ARM on Mac?
<shakesoda>
there will very much be more arm options like pinebooks in the future
<shakesoda>
that's just already been the direction things are going
<shakesoda>
leeward: there's already arm ubuntu, fwiw
<shakesoda>
has been for years
<leeward>
shakesoda: Figures.
<shakesoda>
fedora arm, arch arm etc very much exist too
<shakesoda>
a lot of the usual suspects run on raspberry pis and/or arm servers already
<leeward>
Well, ubuntu and arch got it for free. I don't know anything about the RH ecosystem.
<ifreund>
voidlinux also has quite good support for non-x86 stuff
stripedpajamas has quit [Quit: sleeping...]
penguinicus has joined #zig
<leeward>
Looks like void supports arm and mips. I didn't know people were still making actually new distros.
<oats>
void's an interesting little distro
<oats>
bit too minimalist for me personally, but I can tell a lot of thought went into it
<ifreund>
been using it for a good bit now. xbps (the package manager) supports partial upgrades unlike pacman
<leeward>
I'm spoiled. Debian has pretty much everything I would ever want to run, and any widely used package is likely to be maintained by someone affiliated with the upstream project.
<oats>
ifreund: how do you like it?
<ifreund>
they also have pretty fantastic tooling for cross compiling
<ifreund>
very satisfied, don't miss systemd at all
<oats>
I had a heck of a time trying to get a decent system logging setup when I last tried void
<ifreund>
also not needing the AUR is very nice (i switched from arch)
<companion_cube>
how's the systemd replacement?
<ifreund>
very minimal, though I haven't run into anything I needed that runit didn't support
<ifreund>
boot times are super fast compared to systemd if that's something that matters to you
<ifreund>
one really nice thing about void is that they have a repo with debug builds of all the packages
<ifreund>
makes digging around through backtraces that go into libraries SO much easier
<ifreund>
oats: socklog hasn't given me any troubles fwiw
<oats>
hmm
doublex has quit [Ping timeout: 240 seconds]
stripedpajamas has joined #zig
Snetry has joined #zig
Snetry has quit [Ping timeout: 260 seconds]
<companion_cube>
hmm, systemd is really fast for me, idk
<companion_cube>
does it have .a files tho?
<oats>
I've never done anything that systemd got in the way of
<oats>
unit files are dead-simple to write, and I like how it centralizes some parts of system configuration
<oats>
but I don't want to start a systemd flame war :P
<leeward>
My boot time is roughly 1 eyeblink with systemd, but this machine is super fast.
<oats>
but my use case is thoroughly average
<ifreund>
my main issue with systemd is that it tries to do far too much and is way too complicated for me to reasonably understand
blinghound has joined #zig
<oats>
ifreund: we should rewrite it in zig :>
<oats>
RIIZ
<oats>
ZESF
<ifreund>
no, why?
<blinghound>
is github down?
<oats>
sorry, I was memeing (poorly)
<ifreund>
blinghound: seems to work for me
<oats>
blinghound: not to me
<mq32>
ZigLinux, no libc involved
<ifreund>
i think you mean ziglibc
<mq32>
hm?
<blinghound>
dayum, it must be my region or something
<ifreund>
i've heard rumors that we will eventually ship a libc implementation in zig instead of musl/glibc/whatever
<blinghound>
that's so cool
<blinghound>
I'm getting github anxiety of not being able to push or pull
<CommunistWolf>
git is decentralised
<CommunistWolf>
you'd never know it
<mq32>
ifreund: there is already stuff implemented
<ifreund>
compiler-rt right?
<mq32>
no, that's compiler_rt :D
<mq32>
(which is supplement for non-implemented instruction primitives)
marmotini_ has quit [Ping timeout: 260 seconds]
<ifreund>
ah you're a pedant :D
<mq32>
well, that's not shipped in a libc!
<mq32>
and you need compiler_rt when compiling C code without libc
<mq32>
(freestanding)
blinghound has quit [Remote host closed the connection]
<companion_cube>
rewriting systemd in zig would be awesome
<companion_cube>
it's much better than C for that
<companion_cube>
there was "uselessd" once, but it died
riba has quit [Ping timeout: 256 seconds]
<leeward>
Have people already successfully written Linux kernel modules with Zig?
<nephele>
I only know a (early) kernel written in zig, not about modules for linux
<leeward>
It seems like a worthwhile project, and not too hard to get a trivial one working.
<mq32>
i think daurnimator tried to do so
<mq32>
i have build "Zig-HW-Linux"
<mq32>
which is a linux distro with a single application that prints … hello world
<mq32>
*rofl*
dimenus has joined #zig
<nephele>
so, just put a zig hello world into /init ? :)
<mq32>
exactly!
<mq32>
/sbin/init though
<nephele>
eh /init is nicer
<nephele>
in the initramfs
<mq32>
is that allowed?
<nephele>
its the default for initramfs
<nephele>
you can also then put it into the kernel image
<mq32>
i didn't have a initramfs :D
<mq32>
i just had disk
<fengb>
Zig is pid1?
<fengb>
At that point, do we even want a kernel
<mq32>
"zig run-os /os/my-os.zig"
<fengb>
Oh wait... I'm slowly catching up
<nephele>
mq32, well, its easy to test, compile the kernel, have the initramfs in it and put it as an efi executable in the ESP :P
<nephele>
atleast that is how i did it for a "minimalistic" distro
stripedpajamas has quit [Quit: sleeping...]
<nephele>
not that that ever went anywhere substantial
<mq32>
hm
<mq32>
but it's appealing
<mq32>
we need thin clients at work
<mq32>
right now they use sytemd and stuff
<mq32>
but i could also just use arch and rip out the whole init process and replace that with a bash script :
<nephele>
If you just want more minimalistic i would pick alpine or something
<nephele>
also keep in mind that bash itself is no tiny dep :D
<mq32>
heh
<mq32>
firefox is neither :D
<nephele>
:(
<mq32>
it's a desktop that only needs a modern web browser and displays a web page :D
<leeward>
So...a chromebook?
<mq32>
without storage
<mq32>
or folders
<mq32>
or anything
<mq32>
or users
<fengb>
But the browser is the new OS layer
<fengb>
So might as well run the browser as a kernel
<nephele>
I had one single purpose display in a fire department that shows a webpage, so i test ping 8.8.8.8; to see the network and launched chromium --app=something :D
<leeward>
Didn't Oracle try to push thin clients in the '90s?
<nephele>
seemed overkill that debian with sysd ran on that, but i wasnt goign to replace the whole thing and make it /my/ maintenance burden hehe
<mq32>
leeward: thoose are something different
<mq32>
modern thin client is "runs a single application"
<mq32>
oldschool thin client is "use a small machine to have a full desktop env on a remote machine"
<nephele>
conceptually similar though :)
<leeward>
So you need a good amount of CPU and RAM to run all that javascript locally then.
<mq32>
it depends
<mq32>
RPI2 is "good amount"
<nephele>
I am looking forward to Xtensa in upstream LLVM to run zig code on my ESP
<fengb>
RIP Pi0 :(
<leeward>
Depending on the web pages you want to use and how many of them...
<fengb>
wtb more ram
<mq32>
exactly one, displaying PDF and Markdown
<mq32>
:D
<leeward>
Displaying markdown is displaying html, since it's rendered server side.
<fengb>
We can render markdown locally
<ifreund>
why would we rewrite systemd in zig, we could make something better instead :P
<mq32>
systemd ain't that bad
<mq32>
i like the declarative approach
<ifreund>
the services themselves are fine yes
<mq32>
(that'S what systemd is for me)
<ifreund>
it shouldn't run as pid 1 though
<ifreund>
and should not be require to use e.g. logind
<leeward>
I'll take systemd over sysV init scripts any day.
<mq32>
zinit!
<ifreund>
i'm not saying that sysV init was better, but imo runit and the s6 suite both are
stripedpajamas has joined #zig
<mq32>
ln -s /bin/false /sbin/init
<mq32>
done
<ifreund>
heh
<companion_cube>
just have a small pid1, and a pid2(?) that manages services in the systemd styl
<leeward>
This sounds like the beginning of a systemd flame war. I'll stop.
<mq32>
ifreund: going to read that
<mq32>
want to inform me about more init systems anyways
<fengb>
I mean... that's how every systemd discussion ends up right? :P
<mq32>
faster boot → better
dimenus has quit [Quit: WeeChat 2.8]
<ifreund>
the argument can definitely be made that runit is too limited
<companion_cube>
less shell -> better :D
<andrewrk>
when I reboot, it fails to shut down some service correctly, and takes 1.5 minutes doing nothing before it gives up and times it out. so add +1.5 minutes to boot time if you're doing a reboot
<ifreund>
the s6 suite looks very promising though as more fully featured alternative that maintains a simple and focused design
<mq32>
andrewrk: same here, absolut horror :D
<mq32>
i would love to have an OS that allows rebooting in sub-10-seconds
<ifreund>
yup, i used to get that on arch as well.
<ifreund>
mq32: voidlinux almost certianly will pass that test if you should choose to try it out
<mq32>
i discussed with some and they told me that void may not be the distro for me
<companion_cube>
ifreund: do you know if other people moved from arch to void with satisfaction?
<ifreund>
companion_cube: I believe that's an extreemly common move to make
<ifreund>
pop over to #voidlinux and ask how many switched from arch if you're curious :D
<companion_cube>
how's xbps compared to pacman/yay, if I may ask?
<ifreund>
better, it's impossible to break your system with a partial upgrade
<ifreund>
and you dont need the AUR cause anyone can just open a PR to the main repo and get their package included in core
<companion_cube>
I meant the cli tool
<companion_cube>
oh damn, looks a lot like pkgbuild files
<ifreund>
the cli can do all the same stuff you'd expect from a package manager, not sure I really get the question
<ifreund>
we're definitely off topic for #zig at this point though
decentpenguin has joined #zig
nikita` has quit [Quit: leaving]
_Vi has quit [Ping timeout: 272 seconds]
ur5us has joined #zig
<THFKA4>
package managers are going to become on topic soon, right?
<leeward>
Oh please yes.
penguinicus has quit [Remote host closed the connection]
<traviss>
can anyone remind me what i need in build.zig to be able to pass arguments to tests like this: $ zig build test -- --test-filter test_name
<traviss>
or is this not supported for tests?
decentpenguin has quit [Quit: decentpenguin]
penguinicus has joined #zig
redj has quit [Ping timeout: 264 seconds]
<andrewrk>
I think you have to set that up yourself using build options and options to the addTest function
<andrewrk>
look at zig's own build.zig
st4ll1 has joined #zig
<andrewrk>
there's a setFilter function on a test build artifact
joey152 has quit [Remote host closed the connection]
stripedpajamas has quit [Quit: sleeping...]
Snetry has joined #zig
<traviss>
ah thanks. i'll take a look.
traviss has quit [Quit: Leaving]
alexnask_ has joined #zig
traviss has joined #zig
alexnask has quit [Ping timeout: 272 seconds]
alexnask_ is now known as alexnask
redj has joined #zig
stripedpajamas has joined #zig
alexnask_ has joined #zig
alexnask has quit [Ping timeout: 272 seconds]
Snetry has quit [Ping timeout: 256 seconds]
<traviss>
i was hoping there would be a way to pass the arguments on to the test. it doesn't seem like this is possible.
<traviss>
i can access the args (--test-filter and test_name) via b.args. and main_tests has a property exec_cmd_args: ?[]const ?[]const u8. but i'm not seeing what this is for.
nephele has quit [Ping timeout: 260 seconds]
nephele has joined #zig
alexnask_ is now known as alexnask
nephele has quit [Ping timeout: 260 seconds]
nephele has joined #zig
dermetfan has quit [Ping timeout: 244 seconds]
nephele_ has joined #zig
nephele has quit [Ping timeout: 260 seconds]
nephele_ is now known as nephele
<andrewrk>
traviss, it's possible you might be overextending the testing framework and would be better advised to just build and run your own testing harness
<andrewrk>
that being said, ability to send test arguments with the default test runner could be a reasonable addition to make
<traviss>
makes sense to me. similar to passing -Drelease-mode feels like all of the --test-* arguments could be used with `zig build test`
<daurnimator>
nephele: there's an open project on github for a linux kernel zig module