Thread 105858108 - /g/ [Archived: 352 hours ago]

Anonymous
7/10/2025, 2:07:46 PM No.105858108
1a1420f27f1ff6f69aa6f272189baef7-2132859534
1a1420f27f1ff6f69aa6f272189baef7-2132859534
md5: b71437a17200aac60b224a64db2e87b9🔍
Redpill me on Zig. I mostly program in Go, D, Ruby and JavaScript these days, so all GC. What's the most difficult part of it? Allocators?
Replies: >>105858575 >>105860484 >>105860491 >>105860492 >>105861102 >>105861477 >>105863068 >>105863118 >>105863353 >>105863628 >>105863719 >>105864033 >>105865863 >>105868910 >>105872344
Anonymous
7/10/2025, 2:54:26 PM No.105858552
h2gulg1jowg61
h2gulg1jowg61
md5: 61dc3ec9460e040eae721fc9bddfe31d🔍
Anonymous
7/10/2025, 2:57:34 PM No.105858575
>>105858108 (OP)
Its just a streamlined version of C, which can be used as a build system as well, so you dont neeed make autoconf and all of that stuff.
> What's the most difficult part of it?
The language is unfinished, so your code will break on new versions.
Up to date tutorials are rare, so you will spend lots of time on https://ziglang.org/documentation/master/std/ trying to figure out the standard library
> Allocators
They are very easy for anyone who has used C, its just a table with a malloc realloc and free pointers. If you never manually managed memory, idk. The language has a very nice debug mode compilation, so you will most of the time get informative error messages instead of a cryptic Segmentation Fault, like you do in C.
Anonymous
7/10/2025, 5:53:48 PM No.105860010
based memelang enjoyer
Anonymous
7/10/2025, 6:45:27 PM No.105860484
>>105858108 (OP)
it has troons
Anonymous
7/10/2025, 6:46:57 PM No.105860491
>>105858108 (OP)
>mentions 4 languages, and Go is the one looking good
> 5/10 bait. impressive.
Replies: >>105860606
Anonymous
7/10/2025, 6:47:05 PM No.105860492
>>105858108 (OP)
It's a useless memelang with insufferably verbose syntax.
Replies: >>105863068
Anonymous
7/10/2025, 7:00:11 PM No.105860606
ItsShrimple
ItsShrimple
md5: 425e8d02e661d7f07552cd092b9ee1f1🔍
>>105860491
Not a bait, I actually do program in those. I posted my project called Shrimple (picrel) here, written in Go, and am also working on a text editor in D and Raylib.
Replies: >>105860787 >>105863117 >>105865872 >>105866077
Anonymous
7/10/2025, 7:17:51 PM No.105860787
>>105860606
>Not a bait
that's much worse anon
Replies: >>105860842
Anonymous
7/10/2025, 7:23:24 PM No.105860842
>>105860787
Anyone who has wrote a markdown parser will well you it's irredeemable shit. Anything is an improvement.
Anonymous
7/10/2025, 7:46:21 PM No.105861102
>>105858108 (OP)
Basically just C with comptime and defer. Overall quite comfy if you're coming from C.
Replies: >>105868953
Anonymous
7/10/2025, 8:17:30 PM No.105861477
>>105858108 (OP)
Zig is no longer relevant, its niche closed years ago.
Anonymous
7/10/2025, 10:08:21 PM No.105862614
bump47
Anonymous
7/10/2025, 10:26:35 PM No.105862825
1697567200966599
1697567200966599
md5: e32a7b9a6479b03dcd9b769c567a51cb🔍
it's C with better pointer types, a better alternative to macros and a UB sanitizer that is on by default, but unlike other languages in that design space it interops seamlessly with C instead of trying to eradicate and replace it completely
this makes certain people on /g/ really upset for some reason
Replies: >>105866027 >>105868967
Anonymous
7/10/2025, 10:50:28 PM No.105863068
>>105858108 (OP)
it's great, give it a shot. Hardest part is lack of readily available resources, and imo some of the syntax is ugly

>>105860492
>memelang
I think the momentum is there. Several large projects have been using it for a while (tigerbeetle, bun, ghostty), doesn't use LLVM by default on x64 anymore, async/await coming soon.

there's things I don't like about it but still like it more than C or Rust
Replies: >>105863292 >>105869114 >>105869346
Anonymous
7/10/2025, 10:54:34 PM No.105863117
>>105860606
offtop but "better markdown" is org-mode and Github/codeberg already support it for readme and wiki :)
Replies: >>105863241 >>105868975
Anonymous
7/10/2025, 10:54:35 PM No.105863118
>>105858108 (OP)
>I mostly program in Go, D, Ruby and JavaScript these days, so all GC.
That's scripting, not programming.
Replies: >>105863251
Anonymous
7/10/2025, 11:05:10 PM No.105863241
>>105863117
Yeah, but I'm not into emacs (Vim user here) and I needed something more than just markdown, I needed a static site generator. You don't have to like it, I made what I actually wanted.
Replies: >>105863274
Anonymous
7/10/2025, 11:06:11 PM No.105863251
>>105863118
> That's scripting, not programming.
Sure, whatever makes you feel better about yourself.
Anonymous
7/10/2025, 11:08:31 PM No.105863274
>>105863241
nvim support org-mode, same as VSCode and any other editor.
Anonymous
7/10/2025, 11:10:01 PM No.105863292
>>105863068
>I think the momentum is there.
I've been following the project for several years by now. Occasionally it will look like things are happening but if you zoom out there's not a lot momentum and things progress forward at a glacial pace.
Andrew has terminal NIH syndrome and often refuses to delegate useful work to other people on his team because he is a control freak who needs to have the final say on every design decision. This is why there are a bazillion outstanding issues like the infamous parameter passing bugs, integer/float arithmetic that somehow manages to be both extremely verbose and footgun-prone, a build system that quite frankly sucks massive cock for any non-trivial use case and literal hundreds of unmerged bug fix pull requests.
It's already a decent language but don't delude yourself into thinking it's going to hit version 1.0 and feel complete before 2030.
Replies: >>105863392 >>105865038 >>105866863
Anonymous
7/10/2025, 11:16:34 PM No.105863353
>>105858108 (OP)
The most difficult part of Zig is the fact that it's not 1.0 so every 3-6months Andrew introduces breaking changes so you have to update your applications if you want to keep with the current compiler. If you have never touched a language where you're in charge of the heap allocations Odin might be a better starting off point because it's almost syntactically identical to Go and the std-lib is organized in a very similar way (just make sure you compile with -o:aggressive -no-bounds-check for release builds if you do try it out).
Replies: >>105865055
Anonymous
7/10/2025, 11:20:36 PM No.105863392
>>105863292
not him but personally i trust Andrew with the process because otherwise there will be another Rust that grew out like a tumor from a small niche to a general-purpose lang with more features than c++. I am scared for andrew burnout (which doesn't feel like a distant posibillity) or corpos pushing zig into shit they think will work for their needs
Replies: >>105863946 >>105865038
Anonymous
7/10/2025, 11:43:35 PM No.105863628
4maizo
4maizo
md5: 1bffbd4157ba627f3d57e78b03e95f4a🔍
>>105858108 (OP)
Somedays there are zero threads about this ZIG-nigger programming language, now we have like three threads at the same time.
Go to shill your language to other place, Andrew.
Replies: >>105866863 >>105867945
Anonymous
7/10/2025, 11:51:16 PM No.105863719
>>105858108 (OP)
Its a fine language but I like Odin's syntax, package system and documentation better. Zig would be my next choice for a C alternative though
Anonymous
7/11/2025, 12:14:52 AM No.105863946
>>105863392
C++ has more features than Rust by a wide margin. This is its selling point after all, you can "pick and choose" whatever you like.
Anonymous
7/11/2025, 12:22:35 AM No.105864033
>>105858108 (OP)
>Allocators?
You can always use the default allocator.
Anonymous
7/11/2025, 2:15:15 AM No.105865038
>>105863292
>2030
that's optimistic. lol.
we used to harass Araq (based btw) because nim was perma pre-v1. yet he eventually pulled through, and we are post v2 already. and even then, people were not satisfied, in part because of stupid fucking commit messages, and started a fork.
>>105863392
you had to mention rust and out yourself as a retard, didn't you?
rust is not a big language at all. probably not even 1/10 the size of C++ retard. maybe something retarded like Go is more your speed, that is if you even code.
Anonymous
7/11/2025, 2:17:13 AM No.105865055
>>105863353
It's such a frustrating thing in the current "eco-system"

The mainstream languages all have grandfathered-in bullshit that should simply no longer exist, and the languages that attempt to address these issues are version 0.00001 and you're going to end up contending with bugs in the actual compiler/language rather than having a guarantee that any error is just your own slopcode.
Anonymous
7/11/2025, 4:28:25 AM No.105865863
>>105858108 (OP)
Meme language, not backed by any faaang corps. If faang corps can't work your language into their products, it means it sucks, just like they did with ruby. Zig is the ruby of the modern c style languages. Stick with rust.
Anonymous
7/11/2025, 4:30:02 AM No.105865872
>>105860606
This is actually a cool idea bro. Is it ever going to have code syntax highlighting?
Anonymous
7/11/2025, 4:53:49 AM No.105866027
>>105862825
there is no good reason to keep old ass languages with old ass standards around just because, if theres a will to replace and the replacement is strictly an improvement than it should happen
its more important too as the greybeards start dying out, nobody SHOULD be writing new projects in C, at least not anything serious that will be used by real people for real things
Anonymous
7/11/2025, 5:02:25 AM No.105866077
>>105860606
Can it compile to pdf
Anonymous
7/11/2025, 5:02:56 AM No.105866079
im so lonely
Anonymous
7/11/2025, 7:23:20 AM No.105866863
>>105863628
>print() is somehow better
Explain yourself

>>105863292
The literally hundreds of open and unanswered PRs is the reason why I would never contribute to zig. I like using it but when actually participating in its developments seems it like you are in for a miserable time.
Replies: >>105867820 >>105867945
Anonymous
7/11/2025, 10:31:28 AM No.105867820
>>105866863
>Explain yourself
In Java it's like:
System.console().writer().println(s);
Replies: >>105867903 >>105867945
Anonymous
7/11/2025, 10:49:33 AM No.105867903
>>105867820
I know, but I want to know why this is relevant to you? The higher the level of the language, the less boilerplate there is for accessing stdout. In bqn it's just "Hello World" without any explicit function call. And in zig and Java you need to explicitly get a target and a writer. And you can always write a wrapper and call it just "p" or something.
Replies: >>105867979
Anonymous
7/11/2025, 11:00:04 AM No.105867945
>>105863628
>>105866863
>>105867820
Java 24
https://openjdk.org/jeps/495
void main() {
println("Hello, World!");
}
Replies: >>105867979
Anonymous
7/11/2025, 11:07:27 AM No.105867979
>>105867903
Excuses. See >>105867945
Replies: >>105868117
Anonymous
7/11/2025, 11:38:27 AM No.105868117
>>105867979
zig has std.debug.print() and std.log.debug/info/warn/err() which print to stderr
it doesn't have a shorthand for printing to stdout because most programs should not print to stdout. stdout is for binary data, stderr is for diagnostic messages
Replies: >>105868342 >>105868996 >>105869019
Anonymous
7/11/2025, 11:54:05 AM No.105868204
It still doesn't matter what kind of wrapper is around the printing functions and how many letters the function to print to the console has!
Java calls into a million lines of printstreams and Objects and zig call into thousands of lines with print.
Python has a giant ass runtime that enables the print function and python 2 didn't even have the parenthesis.
Why is that ever a point in any discussion?
Anonymous
7/11/2025, 12:02:35 PM No.105868260
>go
You program in go? That's fucking disgusting.
Anonymous
7/11/2025, 12:15:46 PM No.105868342
>>105868117
What about something like fmt.print that outputs to stdout?

>because most programs should not print to stdout.
COPE harder. Most programs should print to stdout, all console command programs prints to stdout.
Replies: >>105868347
Anonymous
7/11/2025, 12:16:31 PM No.105868345
public class Main {
public static void main(String[] args) throws IOException {
OutputStream os = new FileOutputStream(FileDescriptor.out);
Writer writer = new OutputStreamWriter(os);
BufferedWriter bufferedWriter = new BufferedWriter(writer);

bufferedWriter.write("faggot");
bufferedWriter.newLine();
bufferedWriter.flush();
}
}
Anonymous
7/11/2025, 12:16:37 PM No.105868347
>>105868342
you smell like curry
Replies: >>105868586
Anonymous
7/11/2025, 12:56:38 PM No.105868586
>>105868347
Your programming language library is verbose as Java but I'm the curry smellier, sure dude.
Anonymous
7/11/2025, 1:43:24 PM No.105868910
>>105858108 (OP)
>What's the most difficult part of it?
Actually programming, instead of runtimes and libraries doing it all for you (very slowly).
Anonymous
7/11/2025, 1:48:36 PM No.105868953
>>105861102
GCC and Clang both have defer. Doesn't matter that it's non-standard, since the comparison is to a language that breaks every other week. Windows is irrelevant btw.
Replies: >>105868988
Anonymous
7/11/2025, 1:50:03 PM No.105868967
>>105862825
>it's C with better pointer types
How so (not a troll question)?
Replies: >>105869457
Anonymous
7/11/2025, 1:51:04 PM No.105868975
>>105863117
org-mode is total dogshit. Even worse than Markdown.
Anonymous
7/11/2025, 1:52:22 PM No.105868988
1727172778909897
1727172778909897
md5: 66e96538f0b69bcc4fcebeec8904d80b🔍
>>105868953
GNU C is standard C
Anonymous
7/11/2025, 1:53:28 PM No.105868996
>>105868117
>stdout is for binary data
Are you retarded?
Replies: >>105869274
Anonymous
7/11/2025, 1:56:14 PM No.105869019
>>105868117
>stdout is for binary data
who the fuck told you that?
literally every cli program MUST write plaintext content to stdout in the form of -h/--help (and return 0) for starters. even nocoders know, and are exposed to, that. so what does that make you?
and formatters should work with all IO (roughly. anything representable by an fd). being worse than C in that regard (as implied by your comment, don't know if it's accurate) would be quite the hubristic "achievement" which you would come to expect from the meme that is zig.
Replies: >>105869245 >>105869274
Anonymous
7/11/2025, 2:07:36 PM No.105869114
>>105863068
>async/await coming soon.
DROPPED
Anonymous
7/11/2025, 2:23:27 PM No.105869245
1619825967905
1619825967905
md5: 8730e0c6b7d5696c03e5995ad4218d63🔍
>>105869019
Took the 1/10 bait award.
Anonymous
7/11/2025, 2:27:25 PM No.105869274
>>105868996
>>105869019
i should have worded it differently, i meant that stdout for the main output of your program that is meant to be piped to a file or a different program, which can be plaintext or binary
your program should not write diagnostic messages to stdout, that's what you have stderr for. almost every language in existence gets that wrong and makes the standard "printf" function write to stdout, when the vast majority of uses of printf is for logging and diagnostics. zig fixes this by making the common use case (printing diagnostics) easy to reach for and the less common (printing a pipeable result) slightly more explicit and verbose
>and formatters should work with all IO
they do in zig, you just have to explicitly get a handle to stdout first
// stderr
std.debug.print("faggot\n", .{});

// stdout
var bw = std.io.bufferedWriter(std.io.getStdOut().writer())
try bw.print("faggot\n", .{});
try bw.flush();
Replies: >>105869302 >>105871530
Anonymous
7/11/2025, 2:30:35 PM No.105869302
>>105869274
I don't know if that's the real motivation for the way Zig prints to stdout/stdouterr, but if it is, it's stupid. I don't like languages patronizing me for no reason whatsoever.
Replies: >>105872202
Anonymous
7/11/2025, 2:35:20 PM No.105869346
>>105863068
The language that gets async await right will the language wars 100%. Rust async await is horrible and everyone knows it. C++ co_routines are only good if you have a library like boost that abstracts the complexity of it away.
Anonymous
7/11/2025, 2:49:10 PM No.105869457
>>105868967
In C, a pointer type only tells you what type it is pointing to and whether the data it's pointing to is read-only (const), can be changed outside the currently thread (volatile) or is the only pointer pointing to that data (restrict). That's it. You can't statically know via the type system whether it's pointing to a single value or an array of an unknown size, whether it can store null, whether it's 0-terminated or whether the data is under/overaligned, so you have communicate this information to the user via comments, documentation or other means and hope they have all their assumptions in order. In Zig, all of those pointer attributes are encoded in the type system and you can't mix and match pointers with different incompatible attributes without explicitly asserting that you know what you're doing via casting. It also has slices (address + length fat pointers) but most modern languages do.
Anonymous
7/11/2025, 6:41:25 PM No.105871530
>>105869274
what a midwit language
Anonymous
7/11/2025, 7:45:23 PM No.105872202
>>105869302
Zig is lower-level than C, it doesn't do automatic buffering of io like printf/FILE does in C. It's C and other languages that assume you are too dumb to handle buffering yourself so the language has to parse your stdout and search for newlines and detect when it's over 4096 bytes and flush it and also has secret flush in atexit, which automatically executes after main finishes.
In zig std.debug.print writes to stderr without buffering and it ignores errors, it's not for data use. Stdout is for data use, which it doesn't automatically buffer and it doesn't throw away errors. You have to manually flush it as well at the end to make sure everything is flushed. Go use a baby language instead if you cant deal with how computers actually work.
Anonymous
7/11/2025, 7:58:59 PM No.105872344
>>105858108 (OP)
Zigger
Anonymous
7/11/2025, 8:22:19 PM No.105872569
>current year
>C is still terrible at handling bits
""""low""""" level language
Anonymous
7/11/2025, 8:45:39 PM No.105872803
Plain javascript is about as low level as anyone in this thread should go, including myself.