←back to thread

.NET 10

(devblogs.microsoft.com)
489 points runesoerensen | 9 comments | | HN request time: 0.493s | source | bottom
1. cies ◴[] No.45898206[source]
That's a lot of goodies in a new release! It seems it is outpacing the JVM's development...
replies(1): >>45898403 #
2. lolive ◴[] No.45898403[source]
Apart from [the equivalent of] records, I see nothing big.

Except...

this '''let! a = fetchA() and! b = fetchB()''' really puzzles me. Does C# have a high-level syntax for concurrency timing? [something that Java is strongly lacking, and that Typescript did solve with Promise.all(), which is an ugly syntax, from my perspective]

Any elaboration on this is very welcome.

replies(5): >>45898449 #>>45898472 #>>45898482 #>>45898872 #>>45900126 #
3. JaggerJo ◴[] No.45898449[source]
The code snippet is in F#. And F# has so called "computation expressions".
4. codeulike ◴[] No.45898472[source]
I think thats F# not C#
5. greener_grass ◴[] No.45898482[source]
Here `a` and `b` can have different types:

    let! a = fetchA() and! b = fetchB()
Whereas `Promise.all` usually requires all promises to have the same type (returning a `List<T>` or even a `List<obj>`) .

See https://learn.microsoft.com/en-us/dotnet/fsharp/whats-new/fs...

replies(1): >>45899594 #
6. adgjlsfhk1 ◴[] No.45898872[source]
The inlining and escape analysis changes are fairly big from a performance perspective.

Also, C# doesn't need nearly as many massive changes like project Valhalla because they got a lot of those design choices right from day 1 (mostly by looking at what Java did that was dumb and avoiding it).

7. ajifurai ◴[] No.45899594{3}[source]
Actually, TypeScript's `Promise.all` can handle different types too.

    const [a, b] = await Promise.all([fetchA(), fetchB()]); // => a: A, b: B
replies(1): >>45899723 #
8. greener_grass ◴[] No.45899723{4}[source]
I am talking about C# / F# context where the lists must have homogeneous types.

That TypeScript supports this is yet more complexity introduced to cover usages of an API not designed around types.

9. whoisthemachine ◴[] No.45900126[source]
As others point out, that's F#, but yes C# has `async`/`await`, and has all the `Promise` methods, just under the `Task` class instead (and with slightly different names/calling conventions through out).