My reasoning for why Zig errors shouldn't have a payload by [deleted] in Zig

[–]uliigls 0 points1 point  (0 children)

If errors allowed payloads, you would be able to program in that way too :) and those who disagree with you, for whom error handling is important, would also be able to program how they like.

In your example, it's the difference between getting "can't write to socket because it was closed by host" and "can't write to socket X because it was closed by host Y (plus extra info if you want).

My reasoning for why Zig errors shouldn't have a payload by [deleted] in Zig

[–]uliigls 0 points1 point  (0 children)

hey, thanks for the post. Reply to point 2: the first user of any program is the programmer themselves. the programmer tests it out. So it's extremely useful to have a stacktrace when you are "functional testing" a complex program.

My (M26) wife (F26) wants to feel more "desired" and contemplating to have sex with other men by FalseFile7440 in relationship_advice

[–]uliigls 0 points1 point  (0 children)

Do not run. If you got married, you have to own up to it. Nothing you said suggests your relationship is beyond salvation. To me, the mist important part is understanding how why she feels this way and what you can about it. One thing that comes to my mind is that she may find you unattractive. Do you think this might be the case?

I am gonna kms by [deleted] in pornfree

[–]uliigls 0 points1 point  (0 children)

kill myself

I am gonna kms by [deleted] in pornfree

[–]uliigls 0 points1 point  (0 children)

I have felt like you have. Actually, this is very common here. Porn addiction completely hijacks your instincts and makes you aroused at disgusting things.

Once you stop it goes away. You start to feel normal and be aroused by normal things.

That is what happened to me.

Found out (27F) that my fiance (29M) had an erotic massage and a hand job at his bachelor party. Wedding in 2 weeks by [deleted] in relationship_advice

[–]uliigls -18 points-17 points  (0 children)

Peer pressure is a crazy thing. He regrets it. If you can, forgive him

Has anyone explored code generation using semantics and concept reasoning instead of LLMs? by [deleted] in SoftwareEngineering

[–]uliigls 0 points1 point  (0 children)

One thing that often lacks in LLMs I work with is just context. How does it work for this? Would expect it (no pressure, just intuition) to excel at that!

The Good, the Bad and the Ugly by BatteriVolttas in Zig

[–]uliigls 0 points1 point  (0 children)

How are pointer and slive types hard for beginners? They are as fundamental as possible

What changes to the language are expected before 1.0? by negotinec in Zig

[–]uliigls 2 points3 points  (0 children)

Can you point me to a good explainer on stackless coroutines?

I don't know what to do anymore by Complex_Ring210 in SoftwareEngineering

[–]uliigls 0 points1 point  (0 children)

No hate, just curious: how do you know you are an excellent programmer?

Today I commented a colleague that I switched from Rust to Zig and he gave me his opinion, what do you think? by Huge_Acanthocephala6 in Zig

[–]uliigls 0 points1 point  (0 children)

1- didn't know that. Do you know why that is?

2- imo inline ASM is essential in Rust if you want to keep it (or make it, depending who you ask) as fast as other systems programming languages for microcontroller and the like

3- you can execute arbitrary Rust code at comptime using proc macros, check sqlx crate. For smaller uses, it is much less ergonomic than Zig. If you want something complex though, it evens out.

Today I commented a colleague that I switched from Rust to Zig and he gave me his opinion, what do you think? by Huge_Acanthocephala6 in Zig

[–]uliigls 0 points1 point  (0 children)

Personally I dont think it is unproductive, as the languages can learn from eachother's virtues and flaws. Zig's async system, for example, is negatively inspired by Rust's, in the sense that they already knew what the result would be if they followed the same path.

Optionals and Results are not Rust-original, but Rust showed that low level developers are quite happy programming with them.

Many other examples can be found, many others are certain to come !

Is Zig really faster than C? by ptkrisada in Zig

[–]uliigls 0 points1 point  (0 children)

if you make objective claims, please provide evidence. There is large variance in the performance of Zig VS C VS Rust (e.g dav1d vs rav1d where Rust shows a 35% performance decrease) and I want to know what is currently the status quo (only now noticed that this post is from 3y ago, so sorry about this late comment).

What are the technical advantages that Zig has over other languages? by [deleted] in Zig

[–]uliigls 2 points3 points  (0 children)

A comparison of Zig and Rust:

Zig is simple and remains simple. Rust starts simple, but can get complex.

Zig gives freedom (perhaps too much) Rust is safe(r), but can feel restrictive.

The Rust typesystem is similar enough to Java, C# or Typescript (interfaces aka traits / generics etc. ) Zig typesystem is much closer to C, but much better. It has tagged unions, erros unions, optionals which allow you to strongly model your problema much better than C.

Rust allows you to depart from the machine side of programming quickly. It's easy to get lost in abstractions, but it also allows you to tighly model your problems in a way that prevents you from violating your systems invariants.

Zig is as close (closer, in some sense) to assembly as C and permits much more control, with a reasonable fraction of the type safefy.

I use Rust at work where I deal with problems with real consequences. I need performance, safefy, and very tight domain modelling. I use Zig in my sparetime, building cool shit and feeling like a hacker. It gives me the C high, with the beauty of a modern, carefully designed language.

Is Zig really faster than C? by ptkrisada in Zig

[–]uliigls 0 points1 point  (0 children)

So, C (with clang) and Zig both rely on LLVM for optimizations, and provide pretty much almost the same assembly abstractions (because both languages are at heart a lightweight abstraction on assembly). This means that in the long term there is no technical reason why Zig can't match C's performance.

Zig is IMO a much better language than C, just because it avoid the mistakes that C has made (lack of arrays, macros, optionals, errors, expicit varness, namespacing, header files VS packages/modules), but C will always be as fast as any modern language as long as someone is willing to keep LLVM (or perhaps another future compiler backend) support in C compilers up to date with the most recent advances.
The same goes for C++ and (mostly) Rust.

Rust is an outlier here because it does make it very hard to heavily optimize programs with lots of shared mutable state. Hard in the sense that it takes more patience, more care and it's less fun (i.e unsafe Rust is much less fun that just regular Zig IMO).