News for hackers. Stuff that matters.
Re:Rust Is a Scalable Language by ostenning on Tuesday March 28, 2023 @08:57PM (#35350544)
C# is, in my opinion, a fantastic language. I haven’t used it in a long time, but the “ergonomics” were really nice.

The downside of C# was microsoft, but maybe thats changed now? I know they made a lot of effort to make the .NET framework more cross platform.

Re:Rust Is a Scalable Language by KRAKRISMOTT on Tuesday March 28, 2023 @09:16PM (#35350714)
The problem is the .NET ecosystem. Most of the truly useful frameworks and libraries are either commercial or freemium, and Microsoft is happy to play along and support this cottage industry instead of releasing free in-house versions and crushing the overpriced third party ecosystem.

Another issue is that Microsoft 's first party libraries are now increasingly designed to funnel you into Azure services. The language is great, but the ecosystem is rotten.

Re:Rust Is a Scalable Language by easton on Tuesday March 28, 2023 @10:16PM (#35351330)
I think this very much depends on what you're doing. If it's the typical web app, pretty much everything you'll want is open-source, and most of the time there's some first-party MS thing for what you need (auth? caching? ORM?). We use it at work and don't use any commercial libraries and don't have problems, although it's your typical microservice/distributed pattern. I'm guessing for developing desktop software there's a lot more gremlins.

It actually helps a lot that everything's so open source, because often companies will spit out a SDK for .NET to check a box and not have good docs around it because most of their customers aren't using .NET except for a few enterprise whales.

> Microsoft 's first party libraries are now increasingly designed to funnel you into Azure services.

Outside of the solution for scaling Blazor being "Azure SignalIR service" I'm having trouble with this one too. Their docs often call out Azure, but there's not a ton of bias in support (again, totally might just be that I don't get in the weeds enough).

Re:Rust Is a Scalable Language by KRAKRISMOTT on Tuesday March 28, 2023 @10:33PM (#35351519)
Their official ASP.NET OAuth documentation requires you to either pay for the third party Duende IdentityServer or use Azure cloud services.

https://learn.microsoft.com/en-us/aspnet/core/security/authe...

Re:Rust Is a Scalable Language by easton on Wednesday March 29, 2023 @01:19AM (#35352971)
It says you can use AAD or IdentityServer as OIDC providers, but the doc goes on to explain how to do it yourself with Entity Framework storing user data in a DB and the open source Microsoft.AspNetCore.Identity hooking it into the app.

It would be odd if they only gave like Cognito as an example (especially considering AAD is free). And I didn’t know people really used IdentityServer as much in new apps, there’s other ways to do that.

Re:Rust Is a Scalable Language by KRAKRISMOTT on Wednesday March 29, 2023 @12:25PM (#35359511)
In most use cases with a separate client (e.g. in React), it's easier to use a separate OAuth server. Otherwise you will end up having to change the default cookie settings.
Re:Rust Is a Scalable Language by throwawaymaths on Tuesday March 28, 2023 @09:07PM (#35350628)
The downside of c# is it's easy until you run into the 80 flavors of async it has.
Re:Rust Is a Scalable Language by api on Tuesday March 28, 2023 @09:13PM (#35350693)
Async is a wart, period. It’s an ugly hack around poorly scaling threading abstractions. It basically implements light weight threading but in a way that forces the developer to constantly think about it and clutters up the language with ugly complex async crap.

Go is the only language that gets concurrency right.

Rust async is ugly but it’s ugly because async is ugly and as a systems language there are limits to how much of that ugliness it can hide.

If we could fix threads to scale better at the OS or core library level we’d save insane amounts of developer time.

Re:Rust Is a Scalable Language by throwawaymaths on Tuesday March 28, 2023 @09:49PM (#35351034)
> Go is the only language that gets concurrency right.

Lol. I guess you haven't seen Elixir.

Re:Rust Is a Scalable Language by pg_1234 on Wednesday March 29, 2023 @02:59AM (#35353620)
Go's approach to concurrency exposes Go's lack of memory safety.

When you couple this with a (mostly) bunch of noob devs who have been told Go is super safe because of it's type safety, you have a recipe for disaster.

The combination of language features and surrounding social effects means, once you pursue concurrency, Go abruptly becomes one of the most dangerous languages to use for any industry where subtle errors of value are a problem ... like anything to do with money.

p.s. No slight intended to Elixir, it avoids all these risks.

Re:Rust Is a Scalable Language by Patrickmi on Wednesday March 29, 2023 @03:18AM (#35353742)
Don’t know if use tools like static check but Go’s type system kinda suck without development tools
Re:Rust Is a Scalable Language by vips7L on Tuesday March 28, 2023 @11:49PM (#35352188)
> Go is the only language that gets concurrency right

Java and Elixir both have taken the non-async approach. C# is actively looking into it as well now too: https://twitter.com/davidfowl/status/1532880744732758018

Re:Rust Is a Scalable Language by ithrow on Tuesday March 28, 2023 @09:40PM (#35350947)
Async in the nodejs ecosystem seems to be doing perfectly fine?
Re:Rust Is a Scalable Language by eyelidlessness on Tuesday March 28, 2023 @09:52PM (#35351065)
async (the keyword) is doing fantastic because it’s better than all of the available alternatives. Those alternatives:

- ad hoc callbacks, which had a great Result-ish type signature but really do warrant the “hell” in “callback hell”

- Promise APIs, which are semantically equivalent to async the keyword, unless you care about call stacks, and have a lot of the same hellish problems as the ad hoc callbacks they were meant to address (less nesting! same everything else!)

- Um fibers? Good luck making sense out of whatever that’s doing. It’s a good idea, but it’s also all opaque magic when you try using it.

- Actual threads and child processes… there are valid use cases, and they’re worth pursuing if you have a valid use case, but the facilities for development with them are basically “here’s a bunch of low level concepts that closely mirror their system level counterparts, hope you know/figure out what you’re doing!”

Re:Rust Is a Scalable Language by ithrow on Tuesday March 28, 2023 @11:25PM (#35351960)
By async I was referring to node's asynchronous event-driven runtime abstraction which the GP refers to as an ugly hack. I'm not sure if this abstraction is better than all of the available alternatives if you compare it to high-level features multi-threaded runtimes offer like thread-safe collections, atomic updates, concurrent hash maps, immutability, structured concurrency, etc... as in Java/Clojure. Most Java programmers don't work with the low-level thread primitives.

The author of esbuild gave up trying to code esbuild with nodejs/worker threads and switched to Go for a less limited/restricted concurrency environment.

Re:Rust Is a Scalable Language by eyelidlessness on Wednesday March 29, 2023 @12:42AM (#35352695)
> By async I was referring to node's asynchronous event-driven runtime abstraction which the GP refers to as an ugly hack.

Okay with that clarification I can agree it’s a good model, given its constraints. The event loop with async IO in the abstract is a good way to model a single process/thread workload for many use cases that fit it.

> I'm not sure if this abstraction is better than all of the available alternatives if you compare it to high-level features multi-threaded runtimes offer like thread-safe collections, atomic updates, concurrent hash maps, immutability, structured concurrency, etc... as in Java/Clojure.

Clojure’s solution to concurrency is a breath of fresh air, regardless of your execution environment, because its state transactional semantics are great whether your concurrency is in one process/thread or spread across many. I can’t speak to typical Java solutions, but my general sense is they’re higher level and more powerful than Node’s for actually crossing process/thread boundaries, but subject to most of the shared state problems Java has even in a single process/thread.

> The author of esbuild gave up trying to code esbuild with nodejs/worker threads and switched to Go for a less limited/restricted concurrency environment.

After a lot of exploration of Node worker threads, I’d probably similarly look elsewhere if I had a workload suited to it. You can do a lot with Node worker threads with a lot of special tuning for a use case, and I even have some proof of concept code demonstrating that it can be much better than common usage. But I put it on hold because the complexity of making it perform well is very high compared to optimizing the single thread default.

Re:Rust Is a Scalable Language by schemescape on Tuesday March 28, 2023 @09:10PM (#35350660)
What is there besides Task<T>?
Re:Rust Is a Scalable Language by legulere on Tuesday March 28, 2023 @11:56PM (#35352262)
First there was APM https://learn.microsoft.com/en-us/dotnet/standard/asynchrono... then there came TPL (using Task but without async await but ContinueWith) and finally async await with some later refinements like ValueTask. Generally you just use async await nowadays with maybe the complication of when to use Task or ValueTask
Re:Rust Is a Scalable Language by vips7L on Wednesday March 29, 2023 @01:12PM (#35360173)
C# tends to have this problem with multiple ways to do the same thing. Look at construction:

    var a = new A();
    A a = new();
    A a = new A();
Re:Rust Is a Scalable Language by schemescape on Wednesday March 29, 2023 @06:09PM (#35364534)
When did that second one get added?

I haven't written C# in a while, but I don't remember seeing that one. I skimmed the C# grammar and didn't see it there either, but I only glanced and might have missed an entire section.

Re:Rust Is a Scalable Language by vips7L on Wednesday March 29, 2023 @07:01PM (#35365108)
C# 9.0: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/cs...

I'm honestly surprised they haven't add the ability to drop the `new` keyword like Kotlin:

   val a = A();
Re:Rust Is a Scalable Language by schemescape on Wednesday March 29, 2023 @09:17PM (#35366434)
For anyone else who’s curious, these seem to be called “Target-typed new expressions”.