Live data from Hacker News

I stopped everything and started writing C again

kmx.io

151–160 of 475 posts

Re: I stopped everything and started writing C again

#151
post #146

Earlier quoted context omitted.

I think Rust is harder to learn , but once you grok it, I don't think it's harder to use , or at least to use correctly. It's hard to write correct C because the standard tooling doesn't give you much help beyond `-Wall`. Rust's normal error messages are delightfully helpful. For example, I just wrote some bad code and got: --> src/main.rs:45:34 | 45 | actions.append(&mut func(opt.selected)); | ---- ^^^^^^^^^^^^ expe…

> I think Rust is harder to learn, but once you grok it, I don't think it's harder to use, or at least to use correctly. It's hard to write correct C because the standard tooling doesn't give you much help beyond `-Wall`. When I say Rust is harder to use (even after learning it decently well), what I mean is that it's still easier to write a pile of C code and get it to compile than it is to write a pile of Rust code…

If you're using VS Code then you can add `"rust-analyzer.check.command": "clippy"` to your `settings.json`. I assume there's a similar setting for rust-analyzer in other editors.

Re: I stopped everything and started writing C again

#152
post #55

Here's what kc3 code looks like (taken from [1]): def route = fn (request) { if (request.method == GET || request.method == HEAD) do locale = "en" slash = if Str.ends_with?(request.url, "/") do "" else "/" end path_html = "./pages#{request.url}#{slash}index.#{locale}.html" if File.exists?(path_html) do show_html(path_html, request.url) else path_md = "./pages#{request.url}#{slash}index.#{locale}.md" if File.exists?(p…

Yeah, I'm not sure a lot of people read the article. This isn't really a back to basics, going back to C, forgoing complexity type of article, but instead it's about developing a new programming language called KC3 to make use of ideas he originally developed in Lisp.

Re: I stopped everything and started writing C again

#153
post #130

Earlier quoted context omitted.

> Similar to C, but with much more help from the compiler with all sorts of things. Is that not the problem rust was created to solve?

Rust is more like C++ (though still not really) than like C. Rust is a complete re-imagination of what a systems language could be.

My conclusion is that C is not a good basis for what Rust is trying to do. The kind of reliability Rust is trying to provide with almost no runtime overhead requires a much more complex language than C.

Re: I stopped everything and started writing C again

#154
post #146

Earlier quoted context omitted.

I think Rust is harder to learn , but once you grok it, I don't think it's harder to use , or at least to use correctly. It's hard to write correct C because the standard tooling doesn't give you much help beyond `-Wall`. Rust's normal error messages are delightfully helpful. For example, I just wrote some bad code and got: --> src/main.rs:45:34 | 45 | actions.append(&mut func(opt.selected)); | ---- ^^^^^^^^^^^^ expe…

> I think Rust is harder to learn, but once you grok it, I don't think it's harder to use, or at least to use correctly. It's hard to write correct C because the standard tooling doesn't give you much help beyond `-Wall`. When I say Rust is harder to use (even after learning it decently well), what I mean is that it's still easier to write a pile of C code and get it to compile than it is to write a pile of Rust code…

That's a fair distinction. Basically, it's easier to write C that compiles than Rust that compiles, but it's harder to write correct C than correct Rust.

Regarding Clippy, you can also crank it up with `cargo clippy -- -Wclippy::pedantic`. Some of the advice at that level gets a little suspect. Don't just blindly follow it. It offers some nice suggestions though, like:

  warning: long literal lacking separators
    --> src/main.rs:94:22
     |
  94 |             if num > 1000000000000 {
     |                      ^^^^^^^^^^^^^ help: consider: `1_000_000_000_000`
     |
that you don't get by default.

Re: I stopped everything and started writing C again

#155
post #111

Earlier quoted context omitted.

On x86-type machines, you still have a decent chance, because the instructions themselves are so complicated and high-level. It's not that C is close to the metal, it's that the metal has come up to nearly the level of C! I wouldn't dare guess what a compiler does to a RISC target. (But yes, this was back in the early-to-mid 2000s I think. Whether that is a long time ago I don't know.)

I'd call it a while ago, but not a long time. Long time to me is more like 70s or 80s. I was born in 1996 so likely I'm biased: "before me=long time". It would be interesting to do a study on that. Give the words, request the years, correlate with birthyear, voila

Given how fast our field grows, you might want to consider anything beyond 13 years "a long time ago", since only a tenth of us were around back then[1].

[1]: https://entropicthoughts.com/python-programmers-experience

Re: I stopped everything and started writing C again

#156
post #95

Earlier quoted context omitted.

Jesus wasn't written in Rust? Sounds like a recipe for UB if you ask me.

That's very funny, Jesus was pretty much undefined behavior personified from the perspective of the state/church.

I mean, there was an enormous privilege escalation built in.

Re: I stopped everything and started writing C again

#157
post #127

I'm kinda in the opposite camp. After doing a bunch of VB in my tweens and teens, I learned Java, C, and C++ in college, settling on mostly C for personal and professional projects. I became a core developer of Xfce and worked on that for 5 years. Then I moved into backend development, where I was doing all Java, Scala, and Python. It was... dare I say... easy! Sure, these kinds of languages bring with them other pro…

Have you looked at Zig? It is often termed a modern C where Rust is the modern C++. Seems like a good fit.

Re: I stopped everything and started writing C again

#159
post #32

Earlier quoted context omitted.

Rust is not free of trade offs and you're not helping the cause the way you think you are. Just a few off the top: - Rust is a much more complex language than C - Rust has a much, much slower compiler than pretty much any language out there - Rust takes most people far longer to "feel" productive - Rust applications are sometimes (often?) slower than comparable C applications - Rust applications are sometimes (often?…

> Rust is a much more complex language than C Feature wise, yes. C forces you to keep a lot of irreducible complexity in your head. > Rust has a much, much slower compiler than pretty much any language out there True. But it doesn't matter much in my opinion. A decent PC should be able to grind any Rust project in few seconds. > Rust applications are sometimes Sometimes is a weasel word. C is sometimes slower than Ja…

I don't feel like I need to keep a lot of complexity in my head for C. But one needs to have a concept of how to organize things. I guess Rust forces this onto you.

Re: I stopped everything and started writing C again

#160
post #61
post #8

I started programming with C a long time ago, and even now, every few months, I dream of going back to those roots. It was so simple. You wrote code, you knew roughly which instructions it translated to, and there you went! Then I try actually going through the motions of writing a production-grade application in C and I realise why I left it behind all those years ago. There's just so much stuff one has to do on one…

When Ada was first announced, I rushed to read about it -- sounded good. But so far, never had access to it. So, now, after a long time, Ada is starting to catch on??? When Ada was first announced, back then, my favorite language was PL/I, mostly on CP67/CMS, i.e., IBM's first effort at interactive computing with a virtual machine on an IBM 360 instruction set. Wrote a little code to illustrate digital Fourier calcul…

I recently started re-reading "Programming in Ada" by J.G.P. Barnes about the original Ada. In my opinion, it was not that good of a language. Plenty of ways to trigger undefined behavior.

Where C was clearly designed to be a practical language with feedback from implementing an operating system in C. Ada lacked that kind of practical experience. And it shows.

I don't know anything about modern day Ada, but I can see why it didn't catch on in the Unix world.

Post reply on HN