Live data from Hacker News

Git: Introduce Rust and announce it will become mandatory in the build system

lore.kernel.org

391–400 of 433 posts

Re: Git: Introduce Rust and announce it will become mandatory in the build system

#391

Earlier quoted context omitted.

That's a one time gain though. There's no reason for every platform to check the validity of some hash table implementation when that implementation is identical on all of them. In my opinion, the verification of the implementation should be separate from the task of translating that implementation to bytecode. This leaves you with a simple compiler that is easy to implement but still with a strong verifier that is h…

C is 50 years old or something like that, and it still doesn't have a standard hash map. Sure its not impossible for C to get that, but at the same time, they are trying to write git not fix C. * My point is, that hash maps and data structures like that are clearly not the priority of C or they would **exist by now. ** by exist I mean either in C standard, or a at least a community consensus about which one you pick,…

> or they would *exist by now.

See: https://news.ycombinator.com/item?id=45120171

Nobody needs to change a language standard for 9 lines of code. When you really want to use a hash map, its likely that you care about performance, so you don't want to use a generic implementation anyway.

> or a at least a community consensus about which one you pick

There is a hash table API in POSIX:

    GNU libc:  https://sourceware.org/glibc/manual/latest/html_node/Hash-Search-Function.html
    Linux hsearch(3): https://man7.org/linux/man-pages/man3/hsearch.3.html
    hsearch(3posix): https://www.man7.org/linux/man-pages/man3/hcreate.3p.html

Re: Git: Introduce Rust and announce it will become mandatory in the build system

#392
post #363

Earlier quoted context omitted.

Note that, in compiler lingo, unspecified and undefined are two different things. C++ is specified to death, but full of undefined behavior (and also some unspecified behavior). Rust is largely not specified, but aims to have no undefined behavior (outside of unsafe blocks).

I am aware but without a spec we don’t know which is which. You can’t say it has no undefined behavior because what happens is you try to specify it and find gaps or challenges. In C undefined is used primarily when there is not a reliable and efficient mechanism for detecting a problem is happening. For example a C implementation may check every single invalid pointer deref, but more realistically it only detects on…

Good point.

That being said, at least in C++, undefined has been used largely as a joker for compiler optimizations. In Rust, if my memory serves, having the same code produce different results depending on the optimization level would be considered a pretty serious bug. In C++, it's par for the course.

Re: Git: Introduce Rust and announce it will become mandatory in the build system

#393
post #363

Earlier quoted context omitted.

Note that, in compiler lingo, unspecified and undefined are two different things. C++ is specified to death, but full of undefined behavior (and also some unspecified behavior). Rust is largely not specified, but aims to have no undefined behavior (outside of unsafe blocks).

I am aware but without a spec we don’t know which is which. You can’t say it has no undefined behavior because what happens is you try to specify it and find gaps or challenges. In C undefined is used primarily when there is not a reliable and efficient mechanism for detecting a problem is happening. For example a C implementation may check every single invalid pointer deref, but more realistically it only detects on…

> I am aware but without a spec we don’t know which is which.

I don't think I fully agree with this. A more accurate statement might be that "without a spec we don't always know which is which". You obviously don't need a spec to pin down at least some of a language's behavior, and even then the presence of a spec doesn't necessarily mean that you can answer arbitrary questions about what behavior is intended (c.f., various defect reports in the C/C++ spec asking clarifying questions, pointing out holes/deficiencies, or even admitting that certain behavior is not intended but being unsure about how to forbid it)

Re: Git: Introduce Rust and announce it will become mandatory in the build system

#394

What's the point of trying to introduce Rust everywhere? Git is a mature piece of software and I doubt a lot of new code needs to be written. Also, Rust is very complex relative to C. If you really need classes, templates, etc, you can stick to C++ 98 and get something that is still clean and understandable relative to recent C++ standards and Rust.

Rust has neither classes nor templates.

Re: Git: Introduce Rust and announce it will become mandatory in the build system

#395
post #342

Earlier quoted context omitted.

The issue with investing similar levels of effort into making C++ safer is the C++ standards committee doesn't want to adopt those kinds of improvements.

Which is also the reason why we don't have #pragma once and many other extensions like it. Except we do. Compilers can add rust-like static analyzers without the standard committee mandating it.

In principle, the full lifetime system of Rust can be added to C++ without committee approval, but in reality the chances seem low.

Re: Git: Introduce Rust and announce it will become mandatory in the build system

#396
post #242

Earlier quoted context omitted.

(There is a persistent idea that the lack of memory safety in C is good because it allows people to jailbreak their phones.)

This is not what I said, but memory safety is certainly not anything which is a high priority for my own security. I still think memory safety is important and I also think Rust is an interesting language, but... the hype is exaggerated and driven by certain industry interests.

[deleted]

Re: Git: Introduce Rust and announce it will become mandatory in the build system

#397

Earlier quoted context omitted.

No, it doesn't. OP meant that the Rust support on Cygwin is bad; it is better with the native Windows API.

I don't quite understand. Why use a janky, lossy Linux emulation layer when you can just target Windows natively?

For some reason git for windows is a cygwin build.

Re: Git: Introduce Rust and announce it will become mandatory in the build system

#398

Earlier quoted context omitted.

I don't quite understand. Why use a janky, lossy Linux emulation layer when you can just target Windows natively?

For some reason git for windows is a cygwin build.

Because git expects a POSIX API and POSIX tools and also POSIX behaviour like symlinks and line-endings to do its job.

Re: Git: Introduce Rust and announce it will become mandatory in the build system

#399

Earlier quoted context omitted.

Git works only on cygwin too?

No, it doesn't. OP meant that the Rust support on Cygwin is bad; it is better with the native Windows API.

Git for Windows uses MSYS2, which is a mix of a Cygwin fork and MinGW, the implementation of the Win32 APIs for Linux.

Re: Git: Introduce Rust and announce it will become mandatory in the build system

#400

Earlier quoted context omitted.

The GCC compiler collection has been hit and miss though. Nobody uses gcj for example. I sort of doubt that they'll be able to implement a good compiler for a language that doesn't even have a standard without that implementation going wildly out of date in the future, just like what happened with Java.

There's two different methods by which Rust support can be added to GCC: adding a Rust frontend to GCC and adding a GCC backend to the Rust compiler (rustc_codegen_gcc). The latter approach would not be (as?) susceptible to implementation divergence as an independent frontend.

I hope for the former since then the functionality might become available as attributes in C too.
Post reply on HN