News for hackers. Stuff that matters.
Re:Roc rewrites the compiler in Zig by superlopuh on Tuesday February 04, 2025 @05:25PM (#42939861)
My experience with Zig is that it's also a plausible replacement for C++
Re:Roc rewrites the compiler in Zig by fuzztester on Tuesday February 04, 2025 @05:34PM (#42940017)
explanation needed, bro.

nerdy langnoob or noobie langnerd here. not sure which is which, cuz my parsing skills are nearly zilch. ;)

Re:Roc rewrites the compiler in Zig by chongli on Tuesday February 04, 2025 @07:50PM (#42941803)
Zig’s comptime feature gives a lot of the power of C++ templates. This makes it easier to implement a lot of libraries which are just a pain to do in plain C. Even seemingly simple things like a generic vector are annoying to do in C, unless you abandon type safety and just start passing pointers to void.

I believe Zig even has some libraries for doing more exotic things easily, such as converting between an array of structs and a struct of arrays (and back).

Re:Roc rewrites the compiler in Zig by fuzztester on Wednesday February 05, 2025 @01:43AM (#42944770)
>Zig’s comptime feature gives a lot of the power of C++ templates. This makes it easier to implement a lot of libraries which are just a pain to do in plain C. Even seemingly simple things like a generic vector are annoying to do in C, unless you abandon type safety and just start passing pointers to void.

I get it, thanks. in C you have to cast everything to (void *) to do things like a generic vector.

>I believe Zig even has some libraries for doing more exotic things easily, such as converting between an array of structs and a struct of arrays (and back).

yes, iirc, there was a zig thread about this on hn recently.

Re:Roc rewrites the compiler in Zig by pjmlp on Wednesday February 05, 2025 @01:48AM (#42944809)
Depends on which C++ version you're talking about.
Re:Roc rewrites the compiler in Zig by infamouscow on Tuesday February 04, 2025 @07:11PM (#42941338)
C programmers have long suffered the cumbersome ritual of struct manipulation—resorting to C++ merely to dress up structs as classes.

Zig shatters that with comptime and the 'type' type.

Re:Roc rewrites the compiler in Zig by fuzztester on Thursday February 06, 2025 @05:20PM (#42967096)
jay. eff. cee.

the prejudice and preconceived notions of some of these hn frigtards would be amazing, if it was not known in advance, for a long time now, by me and many others around here, who have more maturity and sense, and who don't have insecurity chips on their shoulders.

i mean, downvoting a perfectly innocuous comment. maybe due to use of the words nerd or noob, even though applied by me to myself, triggers their atavistic, dumbfuck response?

it's good that more sensible people like chongli, pjmlp (old standby here, and usually interesting to read his proglang comments) and infamouscow, are around here (referring to this subthread), otherwise this site would not be worth visiting at all. I, and many others probably, only stick around here, for the relatively rare better threads, that are worth checking out.

as amy hoy of stacking the bricks famously said, fuck hn. it's only optional, not part of my daily tech / biz fix (any more), and i am actively looking out for other, better places to hang out online, to read comments by, and chat with, more sensible people.

https://stackingthebricks.com/

Re:Roc rewrites the compiler in Zig by dang on Thursday February 06, 2025 @11:43PM (#42969499)
Possibly your GP comment came across as a snarky attack because of the first sentence. It's clear that you didn't mean it that way, but there isn't enough information in "explanation needed, bro" to disambiguate your intent (https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...).
Re:Roc rewrites the compiler in Zig by fuzztester on Friday February 07, 2025 @08:55PM (#42979631)
saw this just now.

will reply in a day or two after reviewing my own comments, yours, and your link.