News for hackers. Stuff that matters.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by KingOfCoders on Tuesday May 03, 2022 @08:51AM (#31247642)
Or nothing at all. Rust has an uphill battle since 10 years which shows it's hard to replace C / another language. Might be Rusts borrow checker that prevents adoption, but I doubt it (though it's the reason I use Rust but don't love it).
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by audunw on Tuesday May 03, 2022 @09:17AM (#31247888)
I think the problem with Rust and most other languages, is illustrated by what Zig (for me) does right:

My main motivation for using Zig is that it's rapidly becoming a better C toolchain that GCC or Clang. So I'm extremely motivated to compile all my C code with Zig when it becomes possible. After that it's only natural to write more of my code in Zig.

So, my hypothesis is, a language that could replace C has to have a better C compiler built-in than existing C compilers.

Another side of this, is that it has to be extremely easy to use C from the new language and vice-versa. Something I also think Zig does mostly right.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by atq2119 on Tuesday May 03, 2022 @09:27AM (#31248006)
This is a pretty good hypothesis given the history of C++.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by cestith on Tuesday May 03, 2022 @10:02AM (#31248438)
I don't know about better, but at least almost as good of a C compiler built in seems like a big selling point. So that's, what, Objective C, C++, D, and Zig?

Perl has Inline::C that allows snippets of C code to be placed directly into Perl code like many C and Pascal compilers allow inline assembly. That's for interoperation and an occasional optimization of course, since Perl is in no way a C replacement for much of what's done in C. Do you foresee a replacement language having such inline sections, being a superset language like C++ or Objective C, or being able to just handle separate files/modules in separate languages?

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by sanxiyn on Tuesday May 03, 2022 @09:04AM (#31247763)
Rust just crossed 10% in Firefox. Rust is steadily replacing C and C++ in Firefox, as it was designed to do.

https://4e6.github.io/firefox-lang-stats/

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by einpoklum on Tuesday May 03, 2022 @09:39AM (#31248159)
You mean, in the application maintained by the organization which devised Rust and is its main proponent? Someone I am not very impressed.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by sanxiyn on Tuesday May 03, 2022 @09:44AM (#31248224)
Rust was created to improve the situation where web browsers are written in C++. (I hope we can agree this is bad.) It was not created to impress you.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by dralley on Saturday May 07, 2022 @10:50PM (#31300805)
The combined total of Rust, C, and C++ is only about half of the Firefox codebase. So it's more like 20% (of the code that it might theoretically replace).

Because the code written in HTML and Javascript isn't going to be rewritten in Rust another language, probably ever.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by ZeroCool2u on Tuesday May 03, 2022 @08:56AM (#31247688)
I think one thing that has helped Rust make the first serious advances towards C that we've seen in a long time is also the development tool chain. Getting started with Rust on any major platform, besides embedded development though that's coming along, is so much easier with Rustup and Cargo than the bizarre (to the uninitiated) work you have to do to setup and actually understand your development tool chain in C as well as C++.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by KingOfCoders on Tuesday May 03, 2022 @08:59AM (#31247722)
Yes (working with Scala, Python, JS/TS in the past), Rust hast the most stable and joyful and complete build environment with rustup, cargo, clippy, audit etc.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by scoutt on Tuesday May 03, 2022 @09:42AM (#31248195)
> work you have to do to setup and actually understand your development tool chain in C as well as C++

Open visual studio (or Qt) 'File' menu, 'New C/C++ project'. Press F7 to compile.

No command line, no cargo build, no cargo run, no cargo.toml. Just press the green "play" button and your full graphic application shows up.

Embedded with Arduino C++: 'file' menu, then 'new sketch', click the arrow to compile and download to the board.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by dingoegret12 on Tuesday May 03, 2022 @10:25AM (#31248700)
I work mostly in terminal and won't use clunky IDE programs. I need to be able to

0. Export/upload my source

1. Import/download my remote source

2. Compile my source for different targets

3. Cleanup my source and my compiled source

5. Do all the above for different versions/locations of my source

6. Do all the above for source not my own

7. Do all the above with a simple command and or a simple key->value in a config file

Then I need to do all the above with

8. using a terminal on my personal computer

9. on a remote server using ssh'ed terminal

10. in a script automation file like a docker file or maybe a vim script that setups my dev environment

11. Have 0 - 10 be so easy to do, basically a simple command or two, that I don't have to spend days figuring out tooling FOR EACH TASK and googling mystical error messages for solutions on obscure forums posted 2009.

I stayed with Rust because it has good tooling. Because it's the one thing that hasn't driven me insane at one point or another. I wanted to program in Haskell and c, but I am so sick of the terrible tooling and the terrible conventions of the communities (something Go at least gets right) that I instead program in Rust, a language I enjoy less for it's merit as a language.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by dingoegret12 on Tuesday May 03, 2022 @10:44AM (#31248959)
Mind you I haven't even mentioned the complexities involved in making dependencies optional, platform specific.

I haven't mentioned conditional compilation.

I haven't mentioned respecting the configuration options of dependencies.

The tooling has to at least do all that using the same syntax for commands and configuration. It has to be predictable enough that I can almost figure it out myself. No black magic.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by scoutt on Tuesday May 03, 2022 @10:52AM (#31249086)
You have to do a lot of things. I don't envy you at all!

I work mostly in IDEs and won't use the clunky command line if I have an alternative. After all, it's the year 2022. Why working like it's 1991? I don't want to spoil you the end of the movie, but I have this hunch that graphical user interfaces are the future.

And I don't see what you can't do with VS or Qt. Maybe setting up your toolchain with a script or using terminals (which I don't know what have to do with programming IDEs).

I do most of the above with fricking KEIL uVision for a myriad of microcontrollers!

I compile and edit whole Android OS with VSCode and the integrated SSH terminal! (I hate to use the command line, though!).

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by dingoegret12 on Tuesday May 03, 2022 @02:44PM (#31251923)
The point of not strapping a clunky IDE to my workflow is that a terminal offers flexibility and mobility that I (and everyone who programs in 2022. Maybe not you tho) need to fulfill line items 0-10.

Cargo add pkgname on my computer.

Cargo add pkgname on a ssh session.

Cargo add pkgname in a docker script.

Wow the same process for doing it on my dev pc is the same everywhere else! Amazing. What do you do to automate deployment? ssh in and install your whole graphical tool then write a mouse macro to click the compile button?

You are taking a vacation with a U-Haul truck filled with your furniture. I am taking a vacation with a backpack.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by scoutt on Tuesday May 03, 2022 @05:47PM (#31254034)
It seems we don’t go on vacation to the same places.

There is no need for ssh’ing or recompiling.

For embedded I just give a bin file with everything in it. Use your favorite flashing tool.

For the rest, I can make an installer right from the ide. You know, the kind of 3 click installers the whole world is used to in 2022. An installer I can give grandma. Huge success from the 90’s.

Or maybe redistribute my program with a mobile app market. I can do that from my ide too!

Or maybe I’ll just handle a zip file with everything in it.

I’m afraid you can’t see it’s YOU who are in a niche, and not the other way around.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by dingoegret12 on Tuesday May 03, 2022 @06:10PM (#31254256)
App store? A windows installer? So you just make user apps? Then publish them on existing platforms built by programmers who had to think about all the complexities you blissfully pretend don't exist?

Just email me a binary to flash with a usb stick? Here's a link to download a zip file, just drag and drop into file explorer. Totally scalable stuff. But then again you just make calculators for the android app store, so I guess you're fine.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by scoutt on Tuesday May 03, 2022 @06:50PM (#31254588)
Nope. I do embedded C/C++ and what you can read above. I occasionally do some tooling for desktop or low level APIs. But I know what ides are capable of.

Dont make the mistake of thinking you are better than others, otherwise you’ll keep feeding the general feeling of Rust cultism and you’ll end up programming in niche languages from the command line, 1991 style.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by dingoegret12 on Wednesday May 04, 2022 @02:47AM (#31257471)
You are really obsessed with this 1991 stuff. And here I thought the common prejudice was that only boomers were still stuck using IDE programs. I think you believe yourself to be in an ego battle and that's just not the case for me.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by scoutt on Wednesday May 04, 2022 @04:22AM (#31258004)
I was discussing "work you have to do to setup and actually understand your development tool chain in C as well as C++", and I mentioned IDEs' easy of use. Then you came along saying that the command line is the way for "everyone who programs in 2022"... which is clearly the opposite. If you don't want to see that... I'm sorry but this conversation doesn't have a point.

And you mentioned "boomers" so I know exactly with who I am talking to.

My ego walks away unharmed from this conversation.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by dingoegret12 on Wednesday May 04, 2022 @11:39AM (#31262004)
Actually, I did not start by mentioning anything about years or what is up-to-date. You were the first one to bring up 1991 and current year as a derision.

I believe you have a capable need for the tools you choose to use. I wish I could have sympathized, but the snark you engaged with set the wrong tone.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by Cyph0n on Tuesday May 03, 2022 @10:05AM (#31248463)
Now walk us through how you would use a relatively large library in your new project (e.g., libav or boost). And then show us how to cross-compile both for another OS + arch.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by scoutt on Tuesday May 03, 2022 @10:38AM (#31248889)
libav:

On Windows: download shared from here(1), unzip anywhere. Right click on the project, select "Project settings" (IIRC) then point to .libs you want to use (or add them all), add include path (ffmpeg/include). Done.

On linux (Qt): install with apt-get. Point to libs, add include path (in the .pro file).

The only complication is that you have to wrap the #includes with extern "C" {} if you are on C++.

I did it for both platforms the other day and it works. Super easy.

Cross-compile: on Qt you do it through packs you select at install stage. Sometimes it requires the runtime to be installed (like for Android) but it's not complicated.

On VS, I don't know today. I remember for Windows CE you had to install an SDK, and compilation/debug was out-of-the-box (F7 to compile, F5 to debug in-target). And I used Platform Builder for years, and I cross-compiled the entire OS from the menu.

On Arduino: select your board from the menu. Also, installing libraries is done through a menu. Pulled from online resources automatically.

But I guess I will not convince you. You'll come up with another challenge.

(1) https://github.com/BtbN/FFmpeg-Builds/releases

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by lifthrasiir on Tuesday May 03, 2022 @10:51AM (#31249082)
You have just (inadvertently) demonstrated the exact problem: if you don't have a pre-built binary your job is significantly harder. But everyone knows that and most popular libraries do have a pre-built binary officially or unofficially. That makes this kind of discussion harder, because someone is talking about the worst case and another (in this case you) is talking about the best case.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by scoutt on Tuesday May 03, 2022 @11:04AM (#31249221)
Parent gave two "big libs" as an example (was it a "worst case"?), I choose the one I used the other day and I remember how I used it.

I also remember that I took the "hard" path on Linux and rebuilt ffmpeg, but it was like "git clone", "./configure", "make", "sudo make install". I had to use the command line, but nobody died (being a huge C project and all that).

But we were talking IDEs vs command line and "actually understand your development tool chain in C as well as C++". Of course that niche, worst-case project are going to require more complicated steps. The thing is that the command line and clunkyness is being forced onto the other 99% of the cases too, for simpler projects and dumber persons like myself.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by lifthrasiir on Tuesday May 03, 2022 @11:18AM (#31249385)
> Parent gave two "big libs" as an example (was it a "worst case"?), I choose the one I used the other day and I remember how I used it.

I consider them to be the best case because everyone wants them so there has been some improvement down the road. I think Cyph0n pick a wrong example for that reason.

> I also remember that I took the "hard" path on Linux and rebuilt ffmpeg, but it was like "git clone", "./configure", "make", "sudo make install". I had to use the command line, but nobody died (being a huge C project and all that).

That is a happy case for the reason I've said before. In my experience many libraries do not build that cleanly, it is a routine challenge to determine which flags I have to put to configure or which library I have to install (that might not exist in my distro so I may have to build them as well). Also `sudo make install` alters the global environment, which is never a great idea in Linux distros; so you have to either make sure to run `./configure --prefix=$HOME` or likes, or just run `make` and pick necessary bits out of the build directories yourself. The latter is painful, but the former risks two competing versions of the same library in the global environment.

Honestly though this experience greatly depends on tasks, and you may have barely hit those worse cases in your life. The Windows SDK and Android SDK you've initially cited are two examples where almost everything is available for you and you don't need as many libraries to continue on.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by Cyph0n on Tuesday May 03, 2022 @11:13AM (#31249310)
Just to compare, here's how you would add the latest version of libav to a Rust project using Cargo:

  [dependencies]
  # Safe Rust wrapper
  ffmpeg-next = "5.0.3"
or

  [dependencies]
  # Direct FFI bindings
  ffmpeg-next-sys = "5.0.3"
Note that libav will be built from source, but it will be cached for subsequent builds of your project.

And thanks to the build script maintained by the crate (library) owner, this process should work exactly the same across major OSes and architectures transparently.

Edit: Here is the relevant part of the build script that actually configures and builds libav based on Cargo feature flags and configured rustc OS + arch: https://github.com/zmwangx/rust-ffmpeg-sys/blob/499fca3630fb...

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by scoutt on Tuesday May 03, 2022 @11:19AM (#31249388)
Really? It seems more complicated than that.........

https://github.com/zmwangx/rust-ffmpeg/wiki/Notes-on-buildin...

And "Install FFmpeg (complete with headers) through any means, e.g. downloading a pre-built "full_build-shared".

Come on...

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by Cyph0n on Tuesday May 03, 2022 @11:28AM (#31249496)
Ah, should have been more explicit: you also need a working C compiler (+ make, pkg-config, etc.) and the libav development headers.

As for libav itself, if prebuilt libraries are not present, the build script will fetch the source and build it as a static lib.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by dahfizz on Tuesday May 03, 2022 @09:16AM (#31247871)
Maybe it's just because I am more familiar with C/C++, but I disagree.

Cargo is very opinionated, forcing upon you certain directory structures and even a default VCS. If you have a large project, cargo makes you jump through hoops. Building multiple binaries and libraries from one project is a pain, and has to be done exactly as cargo wants.

In terms of being able to "just get started", I think `gcc app.c` is way easier than using cargo. But that's not really important. You're not going to replace a million line C project with Rust just because "getting started" was a few seconds faster/slower.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by jitl on Tuesday May 03, 2022 @09:26AM (#31248001)
You can `rustc app.rs`, and do all the C Makefile stuff that way too (example in the kernel: https://github.com/Rust-for-Linux/linux/blob/rust/rust/Makef...). Nothing is forcing you to use Cargo except for convenience.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by linkdd on Tuesday May 03, 2022 @09:27AM (#31248011)
> Cargo is very opinionated, forcing upon you certain directory structures

No, it expects source code in `src` like most C/C++ projects anyway. Then it's `lib.rs` or `main.rs`. The opinionated directory structure (`pkg.rs` or `pkg/mod.rs`) is rustc not cargo.

> even a default VCS

Because it's the one used by most projects. Anyway, nothing prevents you from using mercurial, svn, ...

> Building multiple binaries and libraries from one project is a pain

Have you heard of Cargo workspaces? Because I've had no troubles with it.

> I think `gcc app.c` is way easier than using cargo

Agree to disagree. Because really soon, you'll want to manage dependencies.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by einpoklum on Tuesday May 03, 2022 @09:42AM (#31248199)
> it expects source code in `src` like most C/C++ projects anyway

In C/C++ there's no expectation of the code being anywhere.

> Because it's the [VCS] used by most projects.

I don't see how a VCS being popular is a reason to require it. It's not even "essentially all projects", just "most projects".

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by virtualritz on Tuesday May 03, 2022 @10:21AM (#31248642)
> I don't see how a VCS being popular is a reason to require it [...]

Neither do the authors of cargo:

`cargo new --vcs none`

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by linkdd on Tuesday May 03, 2022 @09:55AM (#31248344)
> In C/C++ there's no expectation of the code being anywhere.

That's not what I said. I said that most project do it this way anyway, regardless of any expectations. So who cares?

> I don't see how a VCS being popular is a reason to require it.

It is not required.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by OJFord on Tuesday May 03, 2022 @09:33AM (#31248083)
And linking? Dependency management?

C & Rust come from different eras of easy-getting-started, IMO:

C - I just want to get shit done, I'm not taking on any dependencies, I'll just write it myself and sure it won't be the best but it'll do what I need and keep it simple;

Rust - I just want to get shit done, surely there's a lib for this and that, I can just glue them together.

So with Rust that's no harder to do than doing anything at all; with C it's quite a bit harder but also a bit easier if you don't.

Agreed that's not going to hold any weight in deliberating switching a million line project, but I do think it matters what hobbyists/spare-timers are using, what people want to work with, etc. Slowly.

(E.g. my day job is mainly python; if we needed something highly performant or embedded or whatever I'd be way more comfortable in Rust than ropey university-C.)

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by ssokolow on Tuesday May 03, 2022 @05:31PM (#31253863)
That's Cargo's by-convention auto-discovery. You can manually specify the same information in Cargo.toml if you prefer to customize it.

https://doc.rust-lang.org/cargo/reference/cargo-targets.html...

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by cgh on Tuesday May 03, 2022 @12:53PM (#31250555)
Does Cargo have the equivalent of Maven’s archetypes? Eg, project templates to generate a particular directory structure, some default files, etc.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by ssokolow on Tuesday May 03, 2022 @05:38PM (#31253931)
Currently, it has two built-in ones for `cargo new` and `cargo init` (--bin and --lib) and there are third-party tools like `cargo generate` which provide for more, but they haven't accepted anything into the main distribution yet.

https://github.com/cargo-generate/cargo-generate

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by seba_dos1 on Tuesday May 03, 2022 @09:07AM (#31247792)
When you set things up on your local machine, then this tooling is great. However, once you want to package your stuff, or want to maintain support for a stable distro, you're in for a hell of a ride if you decide to go with Rust. It's not impossible, but it can give you nightmares.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by ssokolow on Tuesday May 03, 2022 @05:40PM (#31253956)
What is currently missing from https://github.com/cross-rs/cross ?
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by seba_dos1 on Wednesday May 04, 2022 @02:17AM (#31257285)
I don't think cross is related to what I'm talking about at all? In fact, relying on it likely makes things worse for downstreams.

For packaging, you want your dependencies to be packaged as well, with build system using system-wide versions instead of pulling things from Cargo, with proper dynamic linking. There are several tools that help you manage that for Rust, Debian has some packaging helpers too, but it's pain nevertheless once you have to, say, support multiple crate versions in your code to deal with stable distros. Some of these troubles come more from the ecosystem than the tooling itself.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by ssokolow on Wednesday May 04, 2022 @09:15AM (#31259931)
Ahh, the dynamic linking thing.

To some extent, I see that more as "Distros have ossified around the workflows and tooling that is essentially 'a third-party package manager like Conan for C++, but for C'".

How do you deal with the same monomorphization problems in C++ libraries? See https://blogs.gentoo.org/mgorny/2012/08/20/the-impact-of-cxx...

How do you deal with vendored single-header libraries and bespoke implementations brought about by C's lack of a cross-distro, cross-platform dependency handling story? You generally don't.

https://wiki.alopex.li/LetsBeRealAboutDependencies#gotta-go-...

As that article points out, Rust's approach to package management allows things to be shared between projects which, in practice, don't get shared between C projects.

With Crates.io not allowing existing crate versions to have their contents modified and Cargo.lock providing a SHA256-verified record of the exact dependencies your project used, you've got a record of what build dependency versions went into your package, which can be used by tools like `cargo audit`.

Yes, it means that you need tooling to automate rebuilding the binaries whenever they're statically linked but, as Michał Górny pointed out in 2012, that's already necessary with libraries that use C++ templates and, as was said in "Let's Be Real About Dependencies", "On the flip side, I wonder how many times vlc’s XML parser has been fuzzed?"

While it's slow going, discussion and an experimental prototype do exist for embedding full dependency versioning information inside Rust binaries to further help that approach: https://github.com/rust-lang/rfcs/pull/2801

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by IgorPartola on Tuesday May 03, 2022 @08:58AM (#31247710)
cc main.c is about as easy as it gets, no?
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by linkdd on Tuesday May 03, 2022 @09:04AM (#31247767)
Now add some dependencies, some required, some optional, for all platforms, or some specific to some platforms.

Then add configuration options for conditional compilation, and a build system to define them properly.

Then use the configuration options of your dependencies in your build system.

Finally, repeat this process for every project and make sure you use the same syntax/api for your build system so you don't have to relearn everything everytime.

cc main.c is as easy as it gets when you rewrite everything from scratch.

cargo is as easy as it gets when you want an ecosystem.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by snovv_crash on Tuesday May 03, 2022 @09:15AM (#31247867)
Add a closed source dependency in Rust and see how far cargo takes you.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by linkdd on Tuesday May 03, 2022 @09:19AM (#31247916)
I assume the closed source dependency is distributed as a .a/.so/.dll file, then you can use bindgen[0].

Still, yes it's a bit more complicated. But can we not pretend that the non-existent toolchain in C/C++ is easier in 99% of use cases?

[0] - https://medium.com/dwelo-r-d/using-c-libraries-in-rust-13961...

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by snovv_crash on Tuesday May 03, 2022 @09:50AM (#31248279)
No, I want a closed source Rust dependency. Otherwise it's going through a C API and I lose all of the benefits of using Rust.

Once you solve this problem, C++ & CMake are of similar complexity for C++ dependencies.

Otherwise to compare C++ toolchains, if it's distributed as a .a file, just adding -l/path/to/libclosed.a works for C++, can't get more simple than that. Or one line in the CMake file with basically the same thing.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by linkdd on Tuesday May 03, 2022 @10:00AM (#31248413)
A .rlib file then, that you can then add with:

  RUSTFLAGS="--extern closedlib=path/to/libclosedlib.rlib"
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by noselasd on Tuesday May 03, 2022 @09:10AM (#31247820)
Yes, but only for tiny tools or toys.

Most software have dependencies that should be managed, linked in, figure the header file path of etc. Most software consists of several files which you don't want to re-build every time you change just 1 file (unless you change compiler flags etc.). It's a very tiny step from your example until the C or C++ toolchain becomes far from easy.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by redman25 on Tuesday May 03, 2022 @09:12AM (#31247841)
Does rust have any other implementations? It seems like that would help adoption as well.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by ______-_-______ on Tuesday May 03, 2022 @09:23AM (#31247966)
Besides the standard llvm-based compiler, I know of at least two others:

https://github.com/Rust-GCC/gccrs

https://github.com/thepowersgang/mrustc

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by mustache_kimono on Tuesday May 03, 2022 @09:43AM (#31248203)
> It seems like that would help adoption as well.

How do you mean? Where?

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by wiremine on Tuesday May 03, 2022 @08:55AM (#31247679)
I've always felt Rust completes more directly with something like C++. It's not nearly as expansive, but the mental space and use cases feel more C++-ish to me. Languages like Zig feels more like a replacement for C.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by dralley on Tuesday May 03, 2022 @08:54AM (#31247669)
Rust has only been post-1.0 for 7 years.
Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by KingOfCoders on Tuesday May 03, 2022 @08:57AM (#31247700)
I agree, though to me it's not great of a difference if something is struggling for 7 or 10 years [1]

[1] just for reference, 0.1 was announced 2012, 10 years ago, 1.0 was announced 2015, 7 years ago.

Re:Will Hare replace C? Or Rust? Or Zig? Or anything else? by cjg on Tuesday May 03, 2022 @09:23AM (#31247976)
According to PyPL's numbers, Rust's growth in popularity has been pretty much exponential since 1.0 with a doubling every ~15 months.