Live data from Hacker News

Rust panics under the hood, and implementing them in .NET

fractalfir.github.io

21–30 of 83 posts

Re: Rust panics under the hood, and implementing them in .NET

#21

This is really neat, I always wanted to see other languages target .NET much like the JVM was a popular platform to target. Considering .NET is fully MIT licensed I am surprised we dont see more languages that target .NET

The lack of a debugger (except for Microsoft's propriety one in VS Code) probably limits the language a bit on open source operating systems.

Re: Rust panics under the hood, and implementing them in .NET

#22

This is really neat, I always wanted to see other languages target .NET much like the JVM was a popular platform to target. Considering .NET is fully MIT licensed I am surprised we dont see more languages that target .NET

The lack of a debugger (except for Microsoft's propriety one in VS Code) probably limits the language a bit on open source operating systems.

What does Rider use? I assume it's not a proprietary MS one? Or did they license it?

Re: Rust panics under the hood, and implementing them in .NET

#23

Earlier quoted context omitted.

.net considers the rust code "unsafe" so you can do unmanaged, non-GC stuff in the Rust portion of the code.

You can already do that from .NET itself. My question here is more along the lines of: "what Rust libs are out there that I might be interested in from .NET?"

One example is the core Temporal.io client, which is implemented in Rust, and wrapped by (most of) the other SDKs including .NET.

I imagine this pattern will become more common for fat clients where it is desirable have a single implementation with idiomatic language bindings.

Re: Rust panics under the hood, and implementing them in .NET

#24
post #14

This is really neat, I always wanted to see other languages target .NET much like the JVM was a popular platform to target. Considering .NET is fully MIT licensed I am surprised we dont see more languages that target .NET

Microsoft didn’t manage to have Visual Basic target .NET without turning its semantics into C# with different syntax, so this will be interesting to see.

Anyone remember J#?

Re: Rust panics under the hood, and implementing them in .NET

#25

Earlier quoted context omitted.

.net considers the rust code "unsafe" so you can do unmanaged, non-GC stuff in the Rust portion of the code.

You can already do that from .NET itself. My question here is more along the lines of: "what Rust libs are out there that I might be interested in from .NET?"

I honestly can't think of any drop-in libraries that would give you much .NET (wow that name sucks to type on mobile) doesn't already give you, though if you're struggling with a particularly slow implementation of something the Rust version is likely faster. I think the more useful case for Rust here is rewriting the heavier or more error-prone parts of your own app logic in it.

Re: Rust panics under the hood, and implementing them in .NET

#26
As a novice with Rust maintaining a cross-platform library written in Rust, I've found panics/unwinding is one of the most annoying things to figure out in the builds for various platforms.

I'm using nostd and panic=abort to keep the library small (around 200kb after being stripped), but it's really not a well-supported setup.

Depending on the platform, I get an error that the _Unwind_Resume symbol is not defined (despite it not supposed to be needed), or if I define it myself I get a duplicate symbol error on other platforms. I ended up linking to gcc_eh on Linux just to avoid the issue.

I just find it strange that out of all the possible issues with using nostd, unwinding is causing the most issues.

Re: Rust panics under the hood, and implementing them in .NET

#27

Earlier quoted context omitted.

The lack of a debugger (except for Microsoft's propriety one in VS Code) probably limits the language a bit on open source operating systems.

What does Rider use? I assume it's not a proprietary MS one? Or did they license it?

They use their own in-house implementation. There's an OSS alternative from Samsung https://github.com/Samsung/netcoredbg but I haven't heard of anyone using it.

In general, the debugger is not intentionally made unavailable but rather the "properietary" one is just the original Visual Studio debugger extracted into a standalone package adapted to cross-platform.

Other than that, CoreCLR exposes rich debugger API, and debugger implementations just integrate with it, there are no "private bits" that would make this task insurmountable, there was just not much need to do so so far, and some Linux folks (as evidenced by skimming through other .NET submissions here) tend to have irrational and unsubstantiated hatred towards .NET which hinders otherwise positive community efforts.

Re: Rust panics under the hood, and implementing them in .NET

#28
post #13

Earlier quoted context omitted.

AFAIK, the IJW bits of the CLR are exclusive to Windows.

And strongly in a "do not use unless you must" category too.

Still easier than dealing with P/Invoke or COM interop for C++ libraries, for C++ skilled devs.

Pity that never made the cross platform jump.

Re: Rust panics under the hood, and implementing them in .NET

#29
post #15

In the past I have worked on Solidity -> Rust compiler, to enable Solidity on WASM VMs. My pain point was emulation of C3 inheritence in Rust, which I actually was able to implement with a few macros. In Rust -> .NET I'm interested in how he does the `DerefMut` trait.

> how he does the `DerefMut` trait.

What do you mean by that? A compiler backend isn't even exposed to high level concepts like traits.

Re: Rust panics under the hood, and implementing them in .NET

#30
post #13
post #9

Earlier quoted context omitted.

In theory, the compiler could do the same as C++/CLI, and output safe Assemblies when specific code patterns aren't used.

AFAIK, the IJW bits of the CLR are exclusive to Windows.

What is exclusive is the Visual C++ backend, because of the usual politics, C++ stuff is not under .NET team.

Likewise the whole WinRT/UWP, .NET Native and C++/CX, were under WinDev umbrella, not DevDiv.

Which is why there is this schizophrenic way of how .NET is currently handled on Windows desktop.

Post reply on HN