Which language is the superior C replacement that's going to win, Rust or Zig?
I thought it was going to be Rust, but this article is making me reconsider: https://kevinlynagh.com/rust-zig/
Which language is the superior C replacement that's going to win, Rust or Zig?
I thought it was going to be Rust, but this article is making me reconsider: https://kevinlynagh.com/rust-zig/
>My interest was not (and still isn’t) in... safety
checks out
zigger cope, rust won
rust cope, c++ won before you were even born
>superior C replacement
Common Lisp.
>no static typing
ngmi
>Not using Coalton or SBCL
ngmi
>rust
overrated but okay
>zig
who?
>instead of just standardizing around C/C++ and working around the limitations of the two languages we need to introduce a million meme languages because IQ rates of programmers keep dropping.
Great.
>instead of just standardizing around C/C++
why not standarize around assembly? or machine code? why introduce meme languages like c/c++?
>instead of just using already standardized languages that work we need to introduce C/C++ languages because IQ rates of programmers keep dropping.
They used to teach better languages like Lisp and Ada in universities and now they teach C because millennials and zoomers would have failed.
C
>coalton
Wrong thread?
more like defected bot
Nim.
Redpill me on the advantages of Nim?
it's like Python and Pascal had a baby
Zig
Good article btw
I encourage you to watch that boomer pov
?t=841
> You should use ranges to create strings with caution, because doing so can crash your program
> muh safety
Rust is becoming a meme slowly but surely
I suggestion to stick to JS/TS + Go + Zig/C for maximum impact on your future career, even more if you want to get out of globohomosexual companies
I suggest*
I refuse to use zig until they implement proper borrow checking and lifetimes and have a plan for HKTs
Does Rust have a plan for HKTs?
Yes
https://blog.rust-lang.org/2021/08/03/GATs-stabilization-push.html
Rust still requires you to take care of memory yourself. The borrow checker only means that the compiler will catch obvious memory errors
GATs are not HKTs
GATs can be used to emulate HKTs
can you give me an example and show how one could use GATs to implement a functor trait?
fyi, a functor is defined like so in a pseudo-rust that supports HKTs
trait Functor<F> {
fn map<T,U,G: Fn(T) -> U>(x: F<T>, f: G) -> F<U>;
}
There's lots of proof of concepts floating around
https://users.rust-lang.org/t/monads-in-rust-with-gats/50487
trait Functor<T> {
type TyCon<U>;
fn map<U, F: Fn(T) -> U>(self, f: F) -> Self::TyCon<U>;
}
impl<T> Functor<T> for Option<T> {
type TyCon<U> = Option<U>;
fn map<U, F: Fn(T) -> U>(self, f: F) -> Option<U> {
match self {
Some(x) => Some(f(x)),
None => None
}
}
}
Unfortunately, there's no guarantee that TyCon is really the right type constructor. You would have to be able to write type equality constraints to ensure that:
type TyCon<U> where Self == TyCon<T>;
And that's not currently possible in a satisfying way (although I suspect that, when chalk gets merged into rustc, it will make it much easier to implement such a feature).
>Rust still requires you to take care of memory yourself. The borrow checker only means that the compiler will catch obvious memory errors
where?
https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html#tymethod.alloc
>https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html#tymethod.alloc
You're trying to sell me unsafe rust?
What's the point in even using unsafe rust?
The same as using C or Zig (which are both inherently unsafe)
>The same as using C or Zig (which are both inherently unsafe)
I believe you don't understand what i am trying to say. The only reason you would want to use Rust is because of its inherently safe design, using unsafe completely diminishes this safety.
>even if you entirely abandon memory safety and fearless concurrency, Rust still has pattern matching, built-in sum types, real generics and greater expressiveness than C++.
How you got to C++ is quite puzzling to me.
I am arguing pro Zig and not pro C++
I understand exactly what you're trying to say. You use unsafe to write safe abstractions, the same thing you would do in C or Zig in any real world program
even if you entirely abandon memory safety and fearless concurrency, Rust still has pattern matching, built-in sum types, real generics and greater expressiveness than C++.
>I refuse to use zig until they implement proper borrow checking and lifetimes
Lol, can't even take care of memory yourself, eh?
have fun with globohomosexual then
All open source is globohomo, this board is globohomo, the entire internet is globohomo. What the frick do you think is the point of a network that allows you to talk to anyone in the entire world
more and more companies reject it
things start to change
more and more normies start to open they fricking eyes
this stack
is future proof
>more and more companies reject it
>things start to change
Won't happen
>more and more normies start to open they fricking eyes
But this is closing your eyes, not opening them
> not arguments
> just deflecting
> troons being the keyboard
100%
>no arguments
>just speculation based on nothing
nothing will replace C but hare is the best alternative
For anyone who isn' interested in merely memes, Dlang (D) has the ability to manually manage memory. It was designed 20 years ago by a C++ compiler programmer to replace sepples, but also is capable of replacing C. Despite a lack of hype, it is a stable and ongoing project backed by its BDFL and is seeing adoption in enterprises here and there.
It's worth checking out if you want no-nonsense, and that is why you will rarely hear IQfy ever discuss it.
I thought it looked good, but I'm curious why it never took off.
Walter Bright writes some very nice Hacker News comments, they're always a pleasure to read. But I get the impression he's spreading himself too thin—this week he's talking about borrowing Rust's borrow checking, that week he's writing an entire C compiler for inside his D compiler, and meanwhile people complain that the compiler as it exists now is half-assed enough to be painful.
Over in Rustland they're willing to postpone features for years and they've got a guy who made it his life's purpose just to improve the error reporting. That's how you create a great language, long tedious refinement before exciting greenfield innovation.
At least that's the picture I get from some half-remembered IQfy posts.
Memory is mostly managed through RAII, so not as explicit as Zig but rather on the level of C++.
If you frick it up then you get an error at compile time.
I have no clue why they posted that link to begin with, but that one's perfectly useful even if 98% of your code is safe.
It's the interface you use to hook up allocating functions. So you use it to write a wrapper for kmalloc or something and then if you do it right the whole standard library now knows how to safely call kmalloc.
Zig is superior but lacks corporate backing like rust. Either is better than C.
Zig is superior, IMO, but Rust, sadly, seems to have achieved critical mass at this point.
Ada.
Sell me on Ada? What does it do that Rust doesn't?
Hare of course. They've cuter logo.
>neither language has block comments
0.10 never, making a language, a c++ build system, a linker, and bootstrap your backend while the old one is still broken? huge mistake