News for hackers. Stuff that matters.
Re:Microsoft is busy rewriting core Windows library code in ... by rgrmrts on Thursday April 27, 2023 @10:10PM (#35736789)
What kind of issues?
Re:Microsoft is busy rewriting core Windows library code in ... by andrewstuart on Thursday April 27, 2023 @11:51PM (#35737298)
Complexity is an issue.
Re:Microsoft is busy rewriting core Windows library code in ... by goolz on Friday April 28, 2023 @12:26AM (#35737469)
Indeed. Perhaps some examples of how Rust is? Would be interested why you think that.
Re:Microsoft is busy rewriting core Windows library code in ... by zgk7iqea on Friday April 28, 2023 @12:49AM (#35737568)
Because of the minimal standard library, the ecosystem is fractured into crates (similar to npm).

Also, rust forces you to actually model the complexity of the real world. I think the best example for this are the various string types. There is one for Interop with C, one for Paths, one that is utf-8 etc. Your code explicitly states what to do with edge cases. Edge cases that existed anyway but are now visible.

Don't get me wrong, I don't dislike Rust. It's an awesome language.

Re:Microsoft is busy rewriting core Windows library code in ... by vlovich123 on Friday April 28, 2023 @01:07AM (#35737643)
Compared to C/C++, I’d say the Rust standard library is very feature full. Regarding crates, they are super easy to pull in compared with random C/C++ libraries, and the crates generally are fairly high quality.
Re:Microsoft is busy rewriting core Windows library code in ... by rastignack on Friday April 28, 2023 @02:38AM (#35738185)
I would say that having methods like ‘and_then_if_finally()’ or ‘then_unwrap_or_none_and_map()’ (I’m barely exaggerating) is less of a feature than say, json parsing and hashing / crypto, which are sorely missing.

Tokio provides a bit more features, but is a damn huge runtime to depend on, and is creating fragmentation.

I feel rust needs to be taken out of the hands of former c++ devs / language theorists and put straight under responsibility of library design experts (rip off go’s stdlib for gods sake!)

Re:Microsoft is busy rewriting core Windows library code in ... by vlovich123 on Friday April 28, 2023 @02:46AM (#35738241)
JSON is handled well enough by serde which is extremely popular. Rust also has various string manipulation utilities and an insanely fast and high quality regexp implementation.

Crypto isn’t a core competency for the standard library authors and this it’s better to offload that responsibility. Maybe once a library becomes de facto in the community (ring?) then it might make more sense.

The other reason to prefer a smaller standard library is that it can often be difficult to strip away the unused bits from the resultant binary. Rust statically links which hopefully fixes most of this, but I suspect possibly not all.

I agree they need to standardize an effect system and unify async so that there’s a way to plug in arbitrary runtimes.

Re:Microsoft is busy rewriting core Windows library code in ... by rastignack on Friday April 28, 2023 @02:55AM (#35738306)
> Crypto isn’t a core competency for the standard library authors and this it’s better to offload that responsibility.

Ring is mostly C/Assembly. Good bye safety ! Offloading core security routines is such a bad design.

> The other reason to prefer a smaller standard library is that it can often be difficult to strip away the unused bits from the resultant binary.

It’s actually already handled quite well, and could also be behind feature flags.

Really, a standard library with feature flags and editions would make rust ridiculously much more productive… such a waste.

Re:Microsoft is busy rewriting core Windows library code in ... by GreedCtrl on Friday April 28, 2023 @06:09AM (#35739418)
For crypto, isn't assembly used to help prevent timing attacks? I don't know if that can be done in pure Rust.
Re:Microsoft is busy rewriting core Windows library code in ... by rastignack on Friday April 28, 2023 @04:17PM (#35746545)
At least let’s get rid of c and put this in stdlib, shall we ?
Re:Microsoft is busy rewriting core Windows library code in ... by nindalf on Friday April 28, 2023 @06:19AM (#35739472)
> Ring is mostly C/Assembly

Crypto needs to be written in Assembly to ensure that operations take a constant time, regardless of input. Writing it in a high level language like C or Rust opens you up to the compiler "optimising" routines and making them no longer constant time.

But you already knew this. And you also knew that the security audit (https://github.com/rustls/rustls/blob/master/audit/TLS-01-re...) of ring was favourable

> No issues were found with regards to the cryptographic engineering of rustls or its underlying ring library. A recommendation is provided in TLS-01-001 to optionally supplement the already solid cryptographic library with another cryptographic provider (EverCrypt) with an added benefit of formally verified cryptographic primitives. Overall, it is very clear that the developers of rustls have an extensive knowledge on how to correctly implement the TLS stack whilst avoiding the common pitfalls that surround the TLS ecosystem. This knowledge has translated reliably into an implementation of exceptional quality.

As a bonus, rustls is under active development with sponsorship from Google, AWS and fly.io, with the aim of making a high quality, memory-safe TLS stack - https://www.memorysafety.org/initiative/rustls/

You said

> a standard library with feature flags and editions would make rust ridiculously much more productive

What's the difference between opting into a library with a feature flag and opting in with a line in Cargo.toml? Let's say you want to use the de-facto regex library. Would it really be ridiculously productive if you said you wanted the "regex" feature flag instead of the "regex" crate?

I do agree that the standard library does need a versioning story so they can remove long deprecated functions. Where it gets complicated is if a new method is reintroduced using the same name in a later edition.

Re:Microsoft is busy rewriting core Windows library code in ... by rastignack on Friday April 28, 2023 @04:20PM (#35746587)
> What's the difference between opting into a library with a feature flag and opting in with a line in Cargo.toml? Let's say you want to use the de-facto regex library. Would it really be ridiculously productive if you said you wanted the "regex" feature flag instead of the "regex" crate?

If you are all alone developing and can audit the crate properly, sure.

However when there’s a team, whose favorite lib should we pick ? How many of them shall we audit ? What’s their license ? How’s code attribution managed ? Etc etc

Re:Microsoft is busy rewriting core Windows library code in ... by nindalf on Saturday April 29, 2023 @01:35AM (#35750333)
Rust had a small standard library and that’s ok (https://blog.nindalf.com/posts/rust-stdlib/)

Your concerns are valid, but Rust has chosen a different set of trade offs. The link outlines the pros and cons.

Re:Microsoft is busy rewriting core Windows library code in ... by SAI_Peregrinus on Monday May 01, 2023 @10:22AM (#35773164)
Crypto MUST NOT become part of the Rust standard library, because Rust's compatibility guarantees would have to be broken when any underlying cryptographic primitive or protocol is broken (or worryingly weakened) and needs to be removed. While that could be done with the "unsoundness fix" escape hatch, it's better to minimize such changes.

I'd like to see an "extension" library managed like the standard library (and shipped with Rust, included in the prelude, etc) but with SemVer, so that breaking changes could be made more easily.

Re:Microsoft is busy rewriting core Windows library code in ... by cookieperson on Friday April 28, 2023 @06:29AM (#35739535)
Go and rust are not the same thing. Go is fine for what it is if you agree with it's opinions. But a lot of people are reaching for rust for different reasons then someone would reach for go. It makes sense that their std libs are different... Especially knowing the differences in the languages themself.

You aren't forced to use the more obscure methods in std. You can almost always recreate them with simple code and suffer no real performance or readability hits.

Former c++ devs are smart people. I work with some, and value their input specifically when designing libraries...

Re:Microsoft is busy rewriting core Windows library code in ... by kaba0 on Friday April 28, 2023 @12:46AM (#35737556)
Accidental complexity is an issue. If your problem is complex you can only have a chance in the battle by using some good abstraction — this is true in both math and CS.