I stopped everything and started writing C again
181–190 of 475 posts
Re: I stopped everything and started writing C again
#182I'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…
The biggest problem with C is that doesn't even have enough features to help you build the features and abstractions you need and want. For example with C++ the language offers enough functionality that you can create abstractions at any level, from low level bit manipulation to high level features such as automatic memory management, high level data objects etc. With C you can never escape the low level details. Cur…
Back in 1994/95, I wrote an API, in C, that was a communication interface. We had to use C, because it was the only language that had binary/link compatibility between compilers (the ones that we used).
We designed what I call "false object pattern." It used a C struct to simulate a dynamic object, complete with function pointers (that could be replaced, in implementation), and that gave us a "sorta/kinda" vtable.
Worked a charm. They were still using it, 25 years later.
That said, I don't really miss working at that level. I have been writing almost exclusively in Swift, since 2014.
Re: I stopped everything and started writing C again
#183Re: I stopped everything and started writing C again
#184Earlier quoted context omitted.
If you come from C to Rust to basically have to rewire your brain. There are some corner cases that are wrong in Rust, but mostly you have to get used to a completely new way of thinking about object lifetimes and references to objects.
...and then you come back to your C code and think 'how could I not think of these things'.
Re: I stopped everything and started writing C again
#185Earlier quoted context omitted.
Have you looked at Zig? It is often termed a modern C where Rust is the modern C++. Seems like a good fit.
i never really understand why these get compared. i wouldn't expect that much overlap in the audiences zig seems like someone wanted something between C and "the good parts" of C++, with the generations of cruft scrubbed out rust seems like someone wanted a haskell-flavoured replacement for C++, and memory-safety i would expect "zig for C++" to look more like D or Carbon than rust. and i'd expect "rust for C" to have…
Re: I stopped everything and started writing C again
#186Earlier quoted context omitted.
The problem is that they are _additions_, C++ has such absurd sprawl. The interactions between everything in this massive sprawl is quite difficult to grasp
That's also a problem in C land, of course, perhaps with less total sprawl. Yeah, it has new features, but you're stuck working on a C89 codebase, good luck! I don't know a great answer to that. I almost feel like languages should cut and run at some point and become a new thing.
Re: I stopped everything and started writing C again
#187I fully understand that sentiment. For several years now, I have also felt the strong urge to develop something in pure C. My main language is C++, but I have noticed over and over again that I really enjoy using the old C libraries - the interfaces are just so simple and basic, there is no fluff. When I develop methods in pure C, I always enjoy that I can concentrate 100% on algorithmic aspects instead of architectu…
In my experience, whether it's software architecture or programming language design, it's easy to make things complicated, but it takes vision and discipline to keep them simple.
Re: I stopped everything and started writing C again
#188Earlier 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…
Rust doesn’t magically make the vast majority of bugs go away. Most of bugs are entirely portable!
Re: I stopped everything and started writing C again
#189I sometimes write C recreationally. The real problem I have with it is that it's overly laborious for the boring parts (e.g. spelling out inductive datatypes). If you imagine that a large amount of writing a compiler (or similar) in C amounts to juggling tagged unions (allocating, pattern matching over, etc.), it's very tiring to write the same boilerplate again and again. I've considered writing a generator to allev…
When I simplify and think in terms of streams, it starts getting nice and tidy.
Re: I stopped everything and started writing C again
#190Earlier quoted context omitted.
True, if C wanted to be Rust it would be just as complicated. But who cares? The fact that C chooses not to nail everything down makes it a simpler and more flexible language, which is why it's sometimes preferred.
Undefined behavior does not make things simpler.