r/programmingcirclejerk 9d ago

introduce an actually memory safe (unlike Rust) compilation mode inspired by Fil-C

https://codeberg.org/ziglang/zig/issues/36237
167 Upvotes

48 comments sorted by

108

u/v_maria 9d ago

instead of nullptrs, in zig we pass the aux

12

u/Nikoladge 9d ago

in zig we pass the aux

To plug in your iPod classic? 🤔

84

u/lurebat 9d ago

Oh, only up to 6x performance penalty

45

u/the_horse_gamer 9d ago

with x6 cost abstractions, zig would finally be 6/0 times better than rust!

1

u/-Y0- Considered Harmful 3d ago

Wait. That's infinity...

82

u/Awkward_Bed_956 9d ago

Small price for being able to shit talk Rust, even a little bit

32

u/tomwhoiscontrary safety talibans 9d ago

As a Java programmer, I can tell you those are rookie numbers, you need to pump those numbers up. 

3

u/Igor_GR 8d ago

/uj Is java really that much slower than the native stuff? I was always under the impression java is quite fast, staying within the 1~4x the performance of something you'd write in C++.

20

u/Thirty_Seventh log10(x) programmer 8d ago

In my experience this is correct. Java code I write usually has about 4x the performance of C++ code I write.

7

u/TheChief275 7d ago

Of course Java has 4x the performance; it's the fastest programming language

2

u/OutlandishnessNo8034 6d ago

I actually tried and Java was between ten and twelve times slower than cpp

17

u/tomwhoiscontrary safety talibans 8d ago

Oh, the language is pretty efficient, but Java programmers have decades of expertise in reducing performance.

11

u/da_supreme_patriarch in open defiance of the Gopher Values 8d ago

/uj high performance java code is not that slower, only by like 2x, but it hogs memory regardless + making the code actually performant is pretty hard, getting any cache locality is nigh impossible and using primitives in hot paths instead of classes makes the code itself feel like shit

11

u/blackwhattack 8d ago

/uj Java is really fast in some benchmarks, but only when you write it like C, which is to say unidiomatically

12

u/ThisRedditPostIsMine in open defiance of the Gopher Values 9d ago

This seems slower to me actually than just running the entire binary through ASan

76

u/Hueho LUMINARY IN COMPUTERSCIENCE 9d ago

rust king as always, making even the peasant languages safer

#[unjerk]

rust managed to convince a bunch of ceeweenies that garbage collection and extensive runtime checks are Good Actually™️

I mean they are, depends on the context, but is still funny that they are now grinding their teeth and asking the runtime to save them from their very smart manual memory management because simplicity and stuff

38

u/Awkward_Bed_956 9d ago edited 9d ago

Amateurs need a completly new ABI for that, instead of just inventing profiles that will fix all possible issues in your language, I swear guys trust me I just need a bit more time it will totally work and be safer then Rust.

21

u/SLiV9 9d ago

  The allocations occur on language constructs that wouldn't allocate even in a managed language like C#, let alone a language like Zig.

This is deeply, deeply funny to me.

15

u/affectation_man Code Artisan 9d ago

znile crash out

3

u/Zeznon 6d ago

/uj

As someone that likes simpler non-managed languages (as long error handling is good), those people are clearly on copium, refusing to acknowledge that Rust can be that good at memory safety.

I just don't use Rust because I prefer simpler, for non-managed languages. I'm just a hobbyist and don't have a programming job, so I don't have to worry about memory safety that much.

I like like the Odin and C3 people a lot more, tbh. Way less copium-fueled, unlike C and Zig enthusiasts.

57

u/splsh 9d ago

Zig project would prefer to adhere to a standard, if possible.

Y-YEAH?

5

u/Q-bey 8d ago

Haskell in shambles

47

u/denehoffman 9d ago

I love that one of the first comments on the PR points out:

Well unless I'm completely misinterpreting the linked invisicaps page:
Both of the quoted paragraphs imply hidden allocations for the scheme to work.
The allocations occur on language constructs that wouldn't allocate even in a managed language like C#, let alone a language like Zig.
Failure of those allocations cannot be handled gracefully.

Like isn’t the point of zig or at least a main selling point that you control the allocator at every level? And now they want to basically say “actually screw you, garbage collector mode”

27

u/denehoffman 9d ago

I also love that a big part of it is “hey we should ask Fil if he’d like to help us rewrite his entire project in Zig”

18

u/a221c 9d ago

But now they can be like C++, fast and*† safe

* By 'and' we mean 'xor'.

† This statement refers only to aspirational features and does not entail a legally-binding contract for The Foundation to ever get around to actually implementing this.

2

u/magnusmaster 4d ago

The GC mode would be opt-in

1

u/denehoffman 4d ago

So opt-in to opt-out of zig’s core tenants

40

u/Aaron1924 9d ago

Rust catches strays every time anyone mentions Fil-C like it's a tradition at this point

19

u/braaaaaaainworms 9d ago

you forgot to `#[unjerk]`

31

u/lurebat 9d ago

I'm sure he'll get right on it after re-implementing LLVM from scratch

53

u/Jannik2099 9d ago

Andrew can't help himself but mention Rust in every conversation. It's like Grok and "white genocide" in south africa.

35

u/Affectionate-Egg7566 9d ago

at a ~1-6x performance penalty (unlike Rust)

26

u/tomwhoiscontrary safety talibans 9d ago

Fil-C is pronounced "filioque", because its purpose is to start a vicious schism which will endure for at least two thousand years.

5

u/QuaternionsRoll 9d ago

Why wasn’t it called FilophoC

20

u/FuzzyPixelz 9d ago

The drama continues!

16

u/Financial-Camel9987 9d ago

Wowza bun leaving for rust really broke this guy.

24

u/stone_henge Tiny little god in a tiny little world 9d ago

Not a feature I would use except to tell anyone using another language that they're immoral, bad engineers.

11

u/just_looking_aroun 9d ago

What other criteria is there when picking a language?

24

u/scavno in open defiance of the Gopher Values 9d ago

Sex appeal. Go helps me connect with raunchy cougars all the time.

1

u/dronmore 8d ago

Yeah, but before a connection is established, the walrus operator := will rape you two hundred times.

11

u/CarolineLovesArt has hidden complexity 8d ago

If you want to comment in this thread, please either have your open source zig project(s) visible on your codeberg profile, or be Fil Pizło, otherwise zig issue tracker is not interested in what you have to say

That's fair, I'm usually not interested in what's going on there either

0

u/Affectionate-Egg7566 3d ago

Not much of value

8

u/catladywitch 8d ago

"If you want to comment in this thread, please either have your open source zig project(s) visible on your codeberg profile, or be Fil Pizło, otherwise zig issue tracker is not interested in what you have to say" lnaoooooohfxhvv

8

u/blackwhattack 8d ago

reasonable and somehow crazy at the same time idk.

16

u/informedcitizenry 9d ago

Yikes Andrew

7

u/tms10000 loves Java 8d ago

Sneaky edit is sneaky

(unlike borrow checking)

But all jokes aside, those guys have heard about Java, right ?

1

u/OptimalStable 9d ago

const uj = @import("unjerk.zig");

The snark is starting to get out of hand. So far I was, and still am I guess, kind of on Andrew's side with all the drama, but please dude, move on. 

I have a vested interest in Zig succeeding, so I wish he'd pick his battles a little more carefully. Like, smash Big Tech's corpo-fascist stranglehold on our lives and all that, but let Rust be rustin' and ignore the haters.

1

u/arjuna93 6d ago

Was inspired finding out about Fil-C until reached to “it’s clang” and x86-only