csharplang
SharpLab
csharplang | SharpLab | |
---|---|---|
280 | 111 | |
12,139 | 2,875 | |
1.0% | 0.9% | |
9.8 | 7.9 | |
3 days ago | 8 months ago | |
C# | C# | |
- | BSD 2-clause "Simplified" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
csharplang
-
"ZLinq", a Zero-Allocation LINQ Library for .NET
Sadly expression trees got out of love in modern .NET and it remains to be seen how much they will ever improve them.
https://github.com/dotnet/csharplang/discussions/158
-
Why Tracebit is written in C#
Here's the language proposal for those that are interested.
https://github.com/dotnet/csharplang/issues/8928
-
The Untouched Goldmine of F#
C# has a much awaited and active proposal to add DUs to C# so I suspect C# will also support this once live (and continue its legacy of plucking great features from F#).
https://github.com/dotnet/csharplang/blob/main/proposals/Typ...
-
The Monad Invasion - Part 3: Railway-Oriented Programming
We cannot blame Monads or ROP for this issue - it is a language limitation. In comparison, this is where a language like F# shines, as it allows us to define a discriminated union type that can carry multiple types of failures. Still, hope is possible - discriminated unions will eventually come to C#.
-
Sets, Types and Type Checking
disjoint union vs union.
Scala3 is the only programming language to implement both AFAIK.
C# has a proposal to add both unions and disjoint unions: https://github.com/dotnet/csharplang/blob/main/proposals/Typ...
OCaml has polymorphic variants which are open disjoint unions.
Kotlin is looking to add union types for errors: https://youtrack.jetbrains.com/issue/KT-68296/Union-Types-fo...
I believe Java's checked exceptions behave somewhat like union types.
-
A comparison of Rust's borrow checker to the one in C#
There is a runtime (not C#) feature that has been added that is relevant to the article: ref fields in structs. Before these, only certain runtime-blessed types like Span could contain refs directly.
In case anyone is interested, here is the spec about refs in structs and other lifetime features mentioned in the article:
https://github.com/dotnet/csharplang/blob/main/proposals/csh...
And here is the big list of ways .NET differs from the publish ECMA spec. Some of these differences represent new runtime features.
https://github.com/dotnet/runtime/blob/main/docs/design/spec...
-
Net 9.0 LINQ Performance Improvements
7 years ago: https://github.com/dotnet/csharplang/issues/1060
3 years ago: https://github.com/dotnet/csharplang/blob/main/meetings/2021...
I've given up submitting to csharplang now. It seemed like a positive when it was first open-sourced, but the proposals/issues are often just circular discussions that go nowhere. It doesn't feel (at least from the outside) that any proposal by a non-MS employee would make it thru the process unless MS needed it themselves. Which is what I was alluding to in my original post.
I may well be wrong and maybe some proposals have made it through, but it feels like an illusion of community collaboration rather than actual community collaboration imho.
-
Why is F# code so robust and reliable?
https://github.com/dotnet/csharplang/blob/main/proposals/Typ...
-
Discriminated unions in 2024
This means we rely on switch expressions rather than a Match function with lambdas for each case. Unfortunately, unlike lambdas, switch expressions don't allow blocks of code. However, we can emulate them like this:
-
.NET Digest #3
Type Unions for C#
SharpLab
- C# Lowering
-
An interesting observation on C# code coverage
Let's put the code into SharpLab.
-
C# devs need to know about sharplab.io
It is not just practice that will help you master C#. Using tools to look under the hood will accelerate your understanding of various language features and helps you write better, more efficient code. Sharplab.io is one such tool that will help you to quickly learn and understand certain C# language features. You can use this tool to show you "lowered" C# code.
-
JavaScript Structs
> I do likely have a biased perspective though, as I use newer C# features every day
I think that is kind of the point, though. Many of those newer features help with simplifying code and making it less boilerplate-y. To old programmers it is a simple code fix in the IDE to move from 30 lines of variable assignments in a switch to a 5 lines switch expression and they can learn that way. People new to the language typically won't even consider going the complicated route because they learned an easier way first.
I do concede that having people with less C# experience on a team where modern C# is used, there will be constructs that are not immediately obvious. SharpLab has an “Explain” mode which would be helpful in such cases, but I haven't seen anything like that in IDEs: https://sharplab.io/#v2:C4LgpgHgDgNghgSwHYBoAmIDUAfAAgBgAJcB...
However, as a personal anecdote, we've had a number of developers who have written mostly Java 1.4 (technical reasons) before switching to C# about a year ago. They took up the newer features and syntax almost without problems. Most questions I got from them were along the lines of “Can we also use this feature?” and not “What does this do?”.
-
JVM/Java: Null-Restricted and Nullable Types
AFAIK you can still use it for older frameworks. The compiler embeds the attributes into the assembly when they're known to not be part of the runtime library [−3.7]. You can do the same with the various conditional nullability attributes.
[−3.7]: https://sharplab.io/#v2:EYLgHgbALAPgAgZgARwExIMJIN4FgBQSRKyc...
-
Is .NET just miles ahead or am I delusional?
Do these all compile to the exact same thing?
https://sharplab.io/#v2:CYLg1APgAgTAjAWAFBQMwAJboMLoN7LpHoCW...
Yes, so you are right.
-
Generating C# code programmatically
Recently, while creating some experimental C# source code generators (xafero/csharp-generators), I was just concatenating strings together. Like you do, you know, if things have to go very quickly. If you have a simple use case, use a formatted multi-line string or some template library like scriban. But I searched for a way to generate more and more complicated logic easily - like for example, adding raw SQL handler methods to my pre-generated DBSet-like classes for my ADO.NET experiment. You could now say: Use Roslyn and that's really fine if you look everything up in a website like SharpLab, which shows immediately the syntax tree of our C# code.
-
The One Billion Row Challenge – .NET Edition
One results in MOVSX, the other in MOVZX [1]. The difference thus is sign/zero extension when moving to the larger register. However, they seem to perform pretty much identical if I'm reading Agner Fog's instruction tables correctly.
[1] https://sharplab.io/#v2:C4LghgzgtgPgAgJgIwFgBQcDMACR2DC2A3ut...
-
Any programs or websites to practice programming?
If you don't have an IDE, you can use SharpLab.io or dotnet fiddle
- Por debaixo do capô: async/await e as mágicas do compilador csharp
What are some alternatives?
language-ext - C# pure functional programming framework - come and get declarative!
.NET Runtime - .NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
dotnet-script - Run C# scripts from the .NET CLI.
BenchmarkDotNet - Powerful .NET library for benchmarking
interactive - .NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.