5 ms·
IEnumerable is to C#/.NET, what std::begin() and std::end() are to C++, and LINQ is to C#/.NET what <algorithm> is to C++. Both interfaces and libraries respect
by delta_p_delta_x 4y ago
IEnumerable is to C#/.NET, what std::begin() and std::end() are to C++, and LINQ is to C#/.NET what <algorithm> is to C++. Both interfaces and libraries respectively are the bread and butter of both languages.
I love both languages, and sincerely hope that C# is able to compile to native at some point in the future; there are already some efforts to compile it to WebAssembly with LLVM [0].
[0]: https://github.com/dotnet/runtimelab/tree/feature/NativeAOT-LLVM https://github.com/dotnet/runtimelab/tree/feature/NativeAOT-...
- DeathArrow 4y agoAOT is coming with NET 7 which will be released in November. https://visualstudiomagazine.com/articles/2022/04/15/net-7-preview-3.aspx https://visualstudiomagazine.com/articles/2022/04/15/net-7-p...
- pooper 4y agoWhen I read the advantages, all but restricted platforms sound like things that would help with server less (aws lambda, azure functions, etc) where we are doing seemingly stupid things like pinging a service once a while to keep it "warm". However, they don't mention this at all. Is asp.net not just another console app?
- DeathArrow 4y agoASP.NET are console apps, yes.
- neonsunset 4y agoSpeaking of serverless, this might be of interest to you: https://github.com/awslabs/dotnet-nativeaot-labs https://github.com/awslabs/dotnet-nativeaot-labs
- GordonS 4y agoMicrosoft also said it was coming in NET 6, NET 5, Dotnet Core 3... Hopefully they actually mean it this time!
- meibo 4y agoWe're already using it to ship a large shared .NET codebase in a native Mac(SwiftUI) application. It's there and it works!
- JamesSwift 4y agoReally interesting. Any references to what you are doing / how you are doing it?
- meibo 4y agoNothing to link to yet, sorry, but we really just followed the "standard procedure" - it basically involved writing a C API to our business logic, which wasn't all too bad for us as the actual API surface we need isn't huge. You could of course circumvent that and use another IPC mechanism based on your preferences. In the end, we get a dylib that we can call like any other. A big pain point is debugging the generated native code, which isn't impossible but best to be avoided. I'd recommend having a good logging infrastructure in place and building abstractions that let you debug and test your .NET code without the UI layer.
- pjmlp 4y agoC# has been able to compile to native since forever. NGEN has been part of .NET since day one, and it always used a JIT, the only version of .NET that has ever done interpretation was the compact framework and micronet. In regards to NGEN as AOT solution, there was mono AOT, CosmOS, IL2CPP, Windows 8 MDIL (Based on Singularity Bartok), .NET Native (Based on Midori efforts, initially known as Project N). And now Native AOT, coming on .NET 7.
- MauranKilom 4y ago> [I] hope that C# is able to compile to native at some point in the future Isn't that what Unity is doing?
- jcelerier 4y ago> LINQ is to C#/.NET what <algorithm> is to C++. algorithms weren't really composable unlike LINQ. Ranges however are, see the examples here: https://mariusbancila.ro/blog/2019/01/20/cpp-code-samples-before-and-after-ranges/ https://mariusbancila.ro/blog/2019/01/20/cpp-code-samples-be... And they also heavily benefit from coroutines, basically allowing to make ranges from anything with e.g. std::generator<T>
- kzrdude 4y agobegin/end is so C++. You get the parts, please use them responsibly and if you don't connect the ends together correctly you get random failures or a crash :) With a 1990s lens it's a revolution, now, not so much.