
Microsoft to Explore Using Rust - danielam
https://www.zdnet.com/article/microsoft-to-explore-using-rust/
======
brighteyes
It's interesting that someone in Microsoft is talking about Rust, but the
article is very flawed. For example,

> C#, a programming language developed by Microsoft, also features some memory
> access improvements but is not as advanced as Rust. [..] Besides [Rust]
> being superior to C# in regards to better memory protections

That's false, isn't it? C# is a memory safe language, period. It relies on GC
for that.

In fact C# has arguably better memory safety than Rust because you can do
things safely in C# that you would be forced to use 'unsafe' in Rust for.
(Granted, then you have overhead from GC, but that's not what the author is
talking about.)

> Rust is also more popular with developers these days and might be easier to
> recruit for.

The author has misinterpreted what "most loved" means in the quoted survey: it
means that _among Rust developers_ , it gets a very high rating. That says
nothing about how big that group is, nor how popular it is in the general
population of developers.

The Rust community is growing but still very small - it's an emerging
language. Almost everyone that uses it _decided_ to use it because they like
it. (That doesn't diminish the accomplishment - there are other emerging
languages that are not as loved by their users.)

~~~
dragonwriter
> C# is a memory safe language, period

It's quite possible that what the author intends by “memory protections” is
broader than what is captured by “memory safety”; e.g., the borrower checker
is, in a sense, a way of protecting memory from unexpected changes in parallel
tasks.

~~~
writepub
Is the author's purported "wording" in the article from extensive coding
experience in rust and c#, or _any_ other language?

Or, did someone prod a journalist with little familiarity in programming
theory, to write positive "spin" on Rust being explored by Microsoft? Is it
even news for the world's largest software company (by market cap), to explore
the use of emerging languages?

~~~
dragonwriter
> the author's purported "wording"

I missed the part where whether the author used words and, if so, which words
they were was a matter of controversy.

~~~
writepub
> “memory protections” is broader ...

That's the part you cited, and went on to imply the author might be referring
to Rust's borrower checker. Nothing from the author's "wording" implies
knowledge of Rust's memory protection techniques

------
ceronman
"70% of all Microsoft patches are for memory-related bugs".

This says a lot. I'm sure Microsoft has very smart and competent engineers,
yet they still get all these bugs. It's because manual memory management is
really, really hard.

I'm baffled to keep hearing some people saying that manual memory management
is okay when the evidence is this huge.

Perhaps for very simple programs is okay to do manual memory management, but
for complex ones like most of them nowadays, it seems close impossible for
humans to write safe programs.

~~~
gwbas1c
Keep in mind that, in kernel mode, things like garbage collection just won't
work!

~~~
hi41
Could you please expand on this. When garbage collection works in applications
and webservers that handle large number of requests, why wouldn't it work in
OS kernel?

~~~
inlined
GC can create noticeable pauses in the whole windows UX because windows scales
vertically in a machine not horizontally in a DC. And per another comment I
made, if your OOM handler needs to JIT it can be catastrophic.

------
bluejekyll
The historic data related to memory access is really damning, 70% of CVE's are
memory access related, and that hasn't changed significantly over the years
charted, 2004 to 2018.

What's annoying in this article is that it doesn't come right out and say that
MS is considering offering a full Windows SDK with a Rust API. The closest I
see the article come to mentioning this is: "Exploring the use of a memory-
safe language such as Rust would provide an alternative to creating safer
Microsoft apps.

But Thomas also argues that third-party developers should also be looking into
memory-safe languages as well. He cites reasons such as the time and effort
developers put into learning how to debug the memory-related security flaws
that crop up in their C++ apps."

It would be interesting to know if a Rust native API is something being
actively worked on at MS.

BTW, MS does ship Rust in a product today, the VSCode editor/ide uses ripgrep
for search, which the article fails to mention as well.

~~~
ChrisSD
> What's annoying in this article is that it doesn't come right out and say
> that MS is considering offering a full Windows SDK with a Rust API. The
> closest I see the article come to mentioning this is: "Exploring the use of
> a memory-safe language such as Rust would provide an alternative to creating
> safer Microsoft apps.

Creating a fully Rustified Windows API interface would be a massive task. The
WinApi is vast and parts of it are ancient. It's practically a living history
of Windows. And that's before you get to the more modern COM and UWP stuff.

What they might offer is a more focused subset.

~~~
contextfree
We (primarily Patrick Reisert, I'm trying to contribute a bit) have been
working on WinRT support for Rust. It is a work in progress but is already
usable now, with some missing capabilities such as UI support.
[https://github.com/contextfree/winrt-
rust](https://github.com/contextfree/winrt-rust)

------
inlined
I wonder if this applies to Windows at all (and in which parts). Windows
Longhorn (using this name for the two years of effectively scrapped work on
Vista) was written in c# but abandoned. The best reason I’ve heard is that the
GC wasn’t suitable for an OS, especially in edge cases. For example, the C++
code I wrote at Microsoft had to gracefully handle an out of memory situation
after any alloc (including setting the STL to not throw exceptions). An out of
memory exception in C# can be catastrophic if the handler had to JIT in low
level OS code.

~~~
giancarlostoro
There's also Midori written in a spin off language of C# by Microsoft:

[https://en.wikipedia.org/wiki/Midori_(operating_system)](https://en.wikipedia.org/wiki/Midori_\(operating_system\))

~~~
inlined
I was fascinated with Midori as a Microsoft employee but nearly 10 years later
I’ve resigned that it will probably be forever a research toy and not be
subject to the same scrutiny as Windows.

~~~
muricula
Midori was laid to rest a few years ago. Production OS kernels in GC'd
languages remain a pipe dream.

~~~
inlined
I’m still holding out for Fuchsia, which is partially built in Go and Rust:

[https://en.m.wikipedia.org/wiki/Google_Fuchsia](https://en.m.wikipedia.org/wiki/Google_Fuchsia)

~~~
muricula
Last I checked all the kernel bits were in C++.

------
frabert
"Besides being superior to C# in regards to better memory protections, Rust is
also more popular with developers these days and might be easier to recruit
for"

Citation needed. I'm quite sure the pool of C#/.NET devs right now is quite a
bit larger than the pool of Rust devs, to be honest, if anything for the sheer
amount of headstart that C# has got over Rust.

~~~
mattmanser
Especially as he mentions SO:

C#: 450 asked today, 2548 this week

Rust: 14 asked today, 82 this week

Yeah, sooooo much more popular.

~~~
adamnemecek
There might also be the aspect that Rust programmers ask fewer questions due
to the fact for example that C# might be taught in a university whereas Rust
programmers come to the language mostly on their own.

~~~
CameronNemo
Would that not skew questions toward Rust, where people rely on online
resources to learn the language and cannot first ask questions ~~during office
hours~~ on piazza?

~~~
0_gravitas
I hang out a every once in a while in the Rust discord (official and
comminity) and theres always a bunch of questions, probably close to the
amount of what SO shows. I haven't dipped into it myself but from what I hear
the Rust book (available for free on their site) and documentation are
_really_ good. So maybe that in combination with other tutorials is a reason
why SO isnt so active. It's a similar deal with Elixir, elixir SO isnt too
active because almost everything is asked on the Elixir forums, so if you go
with SO as your sole popularity meter you're not always going to come away
with accurate conclusions.

~~~
adamnemecek
Can you link to the Rust Discord servers?

~~~
steveklabnik
[https://discordapp.com/invite/rust-lang](https://discordapp.com/invite/rust-
lang) for the team's server

[https://discordapp.com/invite/aVESxV8](https://discordapp.com/invite/aVESxV8)
for the community server

~~~
adamnemecek
thx

------
qzw
If MS is serious about this, I’d like to see them make Rust a first class
option for Windows kernel development. There are a lot of drivers that really
should be “rewritten in Rust”.

~~~
xiphias2
Eventually they should get there, but I don't think that the Rust ecosystem is
ready for that.

Experimenting works the best when MS doesn't yet commit to external Rust API,
but writes new code in Rust (especially CVE bug fixes) and transforms
gradually.

------
mastax
This article is a reblog of Microsoft's post: [https://msrc-
blog.microsoft.com/2019/07/16/a-proactive-appro...](https://msrc-
blog.microsoft.com/2019/07/16/a-proactive-approach-to-more-secure-code/)

------
magicnubs
If this goes anything like their "exploring integrating Python into Excel", in
18 months we'll have heard no more about it and it will be presumed abandoned.

~~~
jsgo
in both cases, it was teams/users within Microsoft and not Microsoft itself,
was it not?

Dunno, I'm glad there are teams looking at things outside of Microsoft
developed technologies. NodeJS receiving kudos for being so good at serving
requests lead to articles about how it could be done in ASP.NET (with some
rearchitecting of the ready bake application code) which apparently gave way
to ASP.NET Core and I'd say if all of that is true, we're all better for it
(ASP.NET developers, anyway).

~~~
magicnubs
I'll definitely agree with that. Broadly, I like the direction Microsoft has
been headed in, I guess I'm just disappointed that there has been no more
information (even them saying they've shelved the idea) after the huge
outpouring of support.

------
nullwasamistake
This is interesting coming from MS! I've used a lot of VM/GC languages and IMO
C# is the best of them all. All the things people complain the most about,
like type erasure in Java, or lack of generics in Go, are done right in C#.

I used it for years and don't have any major complaints.

Hearing that the company with the "best" language (all subjective) is
interested in Rust is exciting.

~~~
jeffdavis
It looks like it's more about breaking into the C++ domain than the C# domain.

------
Stubb
Get ready for R#.

~~~
albanread
This language should be called `Visual Difficult` since it seems to offload
memory management to the human; while the compiler aggressively critiques
them. It is safe though; as in fool proof.

~~~
topspin
"Visual Difficult"

I belly laughed. And I really needed to just then. Thanks.

------
reacharavindh
I thought Microsoft has already been using Rust and contributing to its
ecosystem indirectly via its developers such as Actix and Actix-web, although
it might just be that the author happens to work for MS while building it in
spare time.

~~~
steveklabnik
Microsoft has been using Rust for several things; this is a broader
announcement for a broader audience.

------
zaphirplane
Interesting, I would have expected doubling down on c# and .net maybe some
compile to native. Obviously not for low level, but the stats are not clear on
if it’s general subsystems and applications or low level either

~~~
moksly
Microsoft uses a lot of different techs. Isn’t a lot of their cross platform
and web code for office 365 build with React?

That doesn’t mean they aren’t moving forward with .Net or C#, but the main
thing they want to sell to developers in 2019 is Azure where it used to be
enterprise licenses for VS and windows server. And they don’t need C# for
that.

Also, they seem to be wanting Rust as a replacement for C and C++, so it’s
probably mostly unrelated to C#.

~~~
pjmlp
Yes, they announced at BUILD the new React Native for Windows using WinUI (UWP
update).

------
pictur
Anyone see an article that says bad things about rust? these articles are
shitty.

