this post was submitted on 17 Jan 2024
0 points (50.0% liked)

Programming

17364 readers
204 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
0
Rust vs C (programming.dev)
submitted 9 months ago* (last edited 9 months ago) by modev@programming.dev to c/programming@programming.dev
 

Without any ::prelude and some void* arguments. Maybe you have thoughts about it.

The URL is just a sample of "why" but not "because".

I have my own preference but will keep it inside my mind to not burn a tornado that will erase me from the matrix of the world.

P.S.: I think C is faster, more powerful, and more elegant. I like it more than Rust.

you are viewing a single comment's thread
view the rest of the comments
[–] Pipoca@lemmy.world 11 points 9 months ago (1 children)

C is many things, but elegant really isn't one of them.

C has always been part of the "worse is better"/New Jersey school of thinking. The ultimate goal is simplicity. Particularly simplicity of language implementation, even if that makes programs written in that language more complex or error prone. It's historically been a very successful approach.

Rust, on the other hand, is part of "The Right Thing"/MIT approach. Simplicity is good, but it's more important to be correct and complete even if it complicates things a bit.

I don't really think of void* and ubiquitous nulls, for example, as the hallmark of elegance, but as pretty simple, kludgey solutions.

Rust, on the other hand, brings a lot of really elegant solutions from ML- family languages to a systems language. So you get algebraic data types, pattern matching, non-nullable references by default, closures, typeclasses, expression-oriented syntax, etc.

[–] lysdexic@programming.dev 0 points 9 months ago (1 children)

C has always been (...)

I think you tried too hard to see patterns where there are none.

It's way simpler than what you tried to make it out to be: C was one of the very first programming languages put together. It's authors rushed to get a working compiler while using it to develop an operating system. In the 70s you did not had the benefit of leveraging half a century of UX, DX, or any X at all. The only X that was a part of the equation was the developers' own personal experience.

Once C was made a reality, it stuck. Due to the importance of preserving backward compatibility, it stays mostly the same.

Rust was different. Rust was created after the world piled up science, technology, experience, and craftsmanship for half a century. Their authors had the benefit of a clean slate approach and insight onto what worked and didn't worked before. They had the advantage of having a wealth of knowledge and insight being formed already before they started.

That's it.

[–] Pipoca@lemmy.world 4 points 9 months ago* (last edited 9 months ago) (1 children)

'Worse is better' came from a Common Lisp guy from MIT back in 1991, describing the success of C and UNIX.

It's really not just that Rust is new and C is old. Compare Rust with Go, for example. Go is a fairly modern example of a 'worse is better' language.

Back in 1970s when C was invented, Lisp had been around for over a decade. C came out the same year as smalltalk, a year before ML, and 3 years before Scheme.

Rust is a very modern language, yes. There's no way we could have had it in the 70s; many of its language features hadn't been invented yet. But it very much depends on MIT style research languages for its basis.

[–] ericjmorey@programming.dev 1 points 9 months ago

Interesting how Richard Gabriel framed it as New Jersey (Bell Labs) vs MIT.