Hacker News new | ask | show | jobs
by lossolo 3368 days ago
> there is no reason for it to be my work to prove its doable and often worth the effort.

Why? You don't have expertise needed to do that yourself? It seems you think you have enough to lecture others and write how easy it is (just generate some C code).

> I can point you to numerous examples of people writing and rewriting software

Ok, point me to this software that was rewritten from unsafe C code and was replaced with memory safe language. I don't want any hobby projects, real software used by millions. Give me 10 examples.

2 comments

I too am curious to know of large and prominent C projects rewritten in another language successfully. One recent atypical example that I can think of is the Go compiler.
And unfortunately it become twice as slow because of that[1].

[1] https://cdn.infoq.com/statics_s1_20170328-0458_1/resource/ne...

Good point. A project with the full financial support of Google with a team including Rob Pike, Ken Thompson, Russ Cox and others, in a language that they designed. And it still took a few years and was a huge and stressful process.
When I said "atypical", I was thinking more along the lines of that it is not unusual for compilers to eventually be self-hosting.
Pretty much all of OS development, low level libraries, device drivers etc, are atypical. So are compilers assemblers linkers. Programs that need to allocate and release tens of gigabytes at a time, high performance parallel code etc.

Any language that wants to present themselves as a replacement for C/C++ hast to have at least a reference implementation of all those things so people can start to evaluate (the system).

No one is going to invest the time or the resources into a language to replace what we have if its not an actually up to the task. No one needs another programming language sitting on top of C/C++ that kind of makes things a little better for one class of bugs but will never really replace C/C++ and our our system interfaces.

There is a long list of languages that have made that claim and most of it has turned out to be hot air and marketing.

I am neck deep in C, pretty much all the time, from actual bare metal (i.e. no OS) all the way up to application code, so none of what you mentioned is atypical use of C to me :p

I do not mean to trivialize compilers, linkers and assemblers, but fundamentally they are programs that just read and write files. They don't really have to be in C, IMHO.

I am still waiting for someone to chime in with credible examples of successful C -> non-C transition.

Everyone who has has tried that approach soon after decided to leave the company so they could spend more time with their families...

And your right that compilers etc, do not absolutely need to be written in C/C++. But all of this is taking place in the context of the market. Open source operates in that same market.

If you have two teams working on compilers in different languages and one is using C/C++ its probably going to be much faster with fewer dependencies. 90% of the business is going to go that way and the other team is going under. And so it goes all the way up the stack.

On the other hand what about the kernel and the system libraries? Even if you replaced the whole tool chain with another language but still have a C/C++ kernel and system interface everybody is going to want to use the native interfaces and therefore work in C/C++. So whats the point of adding another layer.

Given what we have now and what peoples expectations are I just don't see 'a replacement for C/C++' ever happening until You can wipe your drive and install a new OS with a kernel and system libraries in a totally different language and never have to touch C/C++ again for the projects developed for that OS.

> Why? You don't have expertise needed to do that yourself?

You are taking code criticism to personally. Keep it professional.

> point me to this software that was rewritten from unsafe C code and was replaced with memory safe language.

From my own field - bunch of libraries for python. Mysql driver for example - used by large amount of people.

Numerous compilers and related tools: Golang runtime for example. Objective-C to Swift migration. Various parts of Firefox. Coreutils (https://github.com/uutils/coreutils). Ruby extensions: https://codeandtalk.com/v/fullstackfest-2015/full-stack-fest... remacs: https://github.com/Wilfred/remacs Whole industries run from C/C++ to Java/Python/.Net. Millions of projects there.

> You are taking code criticism to personally. Keep it professional.

What? I am asking if what you are writing is based on your experience or it's just theory that you've read somewhere. How is this personal?

I am not asking for myself. I already know the answer for that question after reading your comments (the last one only confirmed that), but people that are reading your comment may not, so why don't you just answer the question ?

> Numerous compilers and related tools: Golang runtime for example. Objective-C to Swift migration. Various parts of Firefox. Coreutils (https://github.com/uutils/coreutils). Ruby extensions: https://codeandtalk.com/v/fullstackfest-2015/full-stack-fest.... remacs: https://github.com/Wilfred/remacs Whole industries run from C/C++ to Java/Python/.Net. Millions of projects there.

I am talking about projects that NEEDED C for it's time/space efficiency and cross platform support. Not any C project. Do you see OS kernels in production written in python used by millions ? Do you see video/audio codecs written in Java/python/.net used in production by millions? No. This is where C is used because it's needed.

Coreutils in rust, remacs, ruby extensions - this is not used by millions.

> Objective-C to Swift migration

What? This are different languages. It's not SAME software rewritten from C.

> Various parts of firefox

Whole software, not parts.

So the only valid example you gave is Go (Go compiler is not used by millions by the way). So you gave 1 example instead of 10 and Go compiler is now twice as slow after rewrite.