News for hackers. Stuff that matters.
Re:The Resurgence of C Programming by cryptarch on Tuesday December 27, 2016 @01:16PM (#13264796)
Try Rust maybe?

It has a different learning curve from C, as initially you'll be having a hard time getting programs to compile at all, but from that point the ergonomics are much better and you don't ever have to deal memory bugs unless you're developing a low-level library.

Re:The Resurgence of C Programming by echelon on Tuesday December 27, 2016 @01:27PM (#13264919)
I second this notion. I'm quite productive in Rust now and can string together web services quickly. (To date I've written a text to speech engine, a laser projector renderer, and some image processing stuff.)

Rust is so awesome. Unlike Python or Ruby it's typesafe at compile time. Unlike Java and Go, it has no dumb GC, and unlike C and C++ it's memory safe. At compile time!

Programs can be distributed as a single binary, which makes deployment a breeze.

If that weren't enough, Rust innovates beyond every language I know of with its compile time threadsafety and fucking sweet package manager. (Cargo is seriously the best package manager I've ever used--perhaps the best in existence right now.)

Give Rust a try. It's freaking awesome.

(I'll buy you a coffee if you do and don't like it!)

Re:The Resurgence of C Programming by keldaris on Tuesday December 27, 2016 @05:08PM (#13266627)
Rust certainly seems to have a very enthusiastic (albeit small) user base. I'm someone who usually feels comfortable rapidly switching between a wide variety of languages, including unpopular ones (D is one of my favorites), but I've never seriously tried Rust. There are two reasons for this.

First (and this is the less important one), the syntax seems second only to Java in verbosity and often seems different for no readily evident reason. Secondly, virtually any time someone's advocating for Rust, you get a long lecture about how memory safety is the most important thing in the world and anyone who disagrees is so hopelessly backward that they should be disqualified from writing any code at all. Well, it happens to be very low on my list of concerns. In fact, for most of the low level code I write, memory safety, ownership tracking, borrow checking, etc. are wholly irrelevant. So, given that, should I look at Rust (as compared to C++ and D, which I use and enjoy)? Does it have meaningful advantages that compensate for its syntax, immaturity and performance limitations (vectorization, etc.)?

I've asked a few Rust users this before, but never really gotten a satisfactory answer that didn't involve the same memory/thread safety argument. Give me one and I'll happily give Rust a try, no coffee necessary. :)

Re:The Resurgence of C Programming by jjnoakes on Tuesday December 27, 2016 @05:58PM (#13266984)
Can you give examples of C++ code which would not require you to keep the ownership or borrowing straight in your head, and which a port to Rust would cause you unnecessary verbosity?

I usually find that if my C++ code required little to no mental tracking of ownership or borrowing or lifetimes, the rust was straight forward. And if the rust was complex, the C++ required me to keep too much in my head (or even had bugs).

Re:The Resurgence of C Programming by keldaris on Tuesday December 27, 2016 @08:59PM (#13267882)
Technically, all code requires you to keep track of ownership and borrowing. In cases where these are intellectually trivial concerns (which, I would argue, are by far the most common cases), Rust's forcibly explicit approach is, if you accept the assumption of the previous sentence, unnecessarily verbose by definition.

I cannot address the latter part of your argument (the more important part, I think), however, because as I stated, I have not invested serious effort in Rust. Intuitively, from the code and documentation I've seen, I'd be wary of trying to implement, say, highly performant (emphasis on the performance) cyclic graphs in Rust rather than C++, but that's merely an impression, hence my interest in learning more. And certainly, whatever the difficulty, the likelihood of bugs in C++ would be higher.

Re:The Resurgence of C Programming by jjnoakes on Tuesday December 27, 2016 @10:24PM (#13268211)
I don't find rust verbose unless I am dealing with complex situations though; that was my point.

Move-by-default, elided lifetimes on many parameters, etc, are all verbosity-free.

Re:The Resurgence of C Programming by steveklabnik on Tuesday December 27, 2016 @06:34PM (#13267236)
https://news.ycombinator.com/item?id=13265758 has a lot of discussion on this topic.

Not your parent, but instead of writing my own thoughts here, I think I'll write a blog post tomorrow :)

Re:The Resurgence of C Programming by keldaris on Tuesday December 27, 2016 @09:08PM (#13267913)
FWIW, I've seen people praise traits, but never seen any in depth discussion of their advantages and limitations with respect to, say, C++ polymorphism (both dynamic and static, via CRTP etc. for zero cost OOP) and trait classes. Similarly, algebraic types are frequently mentioned, but only with simple matching examples and scarce discussion of the limitations. I'm sure other aspects of the language I'm not immediately aware of also deserve more discussion.

Anyway, looking forward to your post.

Re:The Resurgence of C Programming by tatterdemalion on Tuesday December 27, 2016 @06:43PM (#13267295)
Ownership helps me design code which is decoupled and easy to refactor.

Rust traits are more powerful, expressive, and maintainable than other polymorphism systems like inheritance.

Re:The Resurgence of C Programming by CorvusCrypto on Tuesday December 27, 2016 @01:41PM (#13265018)
Idk if I share your enthusiasm, but rust is pretty cool. Certainly has its uses though for bare metal I'd still say go with C (and ASM) if using atmel's AVR chips. At least until rust gets a working compiler to AVR. Seems it is getting ever closer https://github.com/avr-rust/rust
Re:The Resurgence of C Programming by cm2187 on Tuesday December 27, 2016 @01:47PM (#13265091)
How developed is the ecosystem? One thing I enjoy about .net is the huge number of free and commercial libraries, the great IDE, and the ability to code a very broad range of applications with a single language (website, CLI, GUI, service, etc). Is Rust comparable?
Re:The Resurgence of C Programming by echelon on Tuesday December 27, 2016 @01:54PM (#13265159)
Not at all. Rust has a long, long road ahead before it has an ecosystem comparable to Java or .NET. These systems have literally man centuries of work poured into them.

That said, I still predict Rust becoming the most important language of the decade, if not the decades that follow simply due to the strength of its foundation. Rust solves problems that no other language has--real problems with actual costs--, and fits into a very interesting space where it can eat away at the lethargic incumbants.

Rust is a web service language [1]. A desktop application language [2]. A CLI tooling language [3]. A core system library language. A game development language (eventually) [4]. It has a bright future ahead in so many different domains, and the tooling and libraries will come and reinforce this.

[1] Hyper, Iron

[2] Servo

[3] Ripgrep

[4] Piston

Re:The Resurgence of C Programming by naasking on Wednesday December 28, 2016 @11:38AM (#13271633)
I suggest a thought experiment: take a few random projects you have or plan to work on, go to [1] and search for the kind of packages you need and see what's missing. It's getting better all the time, and you'll find most straightforward projects are totally doable in Rust.

[1] https://crates.io/

Re:The Resurgence of C Programming by rb808 on Tuesday December 27, 2016 @01:28PM (#13264927)
That does sound freaking awesome, I really will have to try it out.
Re:The Resurgence of C Programming by echelon on Tuesday December 27, 2016 @01:48PM (#13265102)
The borrow checker is hard to deal with at first, but after you power through the initial difficulty it becomes second nature. I rarely have to fight the compiler, and when I do it's because I'm trying to do something stupid.

In a way I'd liken learning Rust to learning Vim. There is an upfront cost, but the payoff is going to be huge.