When comparing Nim vs C#, the Slant community recommends C# for most people. In the question“What are the best languages for learning functional programming?” C# is ranked 22nd while Nim is ranked 24th. The most important reason people chose C# is:
.NET offers rich functionality.
Ranked in these QuestionsQuestion Ranking
Pro Great metaprogramming features
There are generics, templates, macros in Nim. They can allow you to write new DSL for your application, or avoid all boilerplate stuff.
Pro Strict typing
Checks your code at compile time.
Pro Easy to read
Nim has a lot of common with Python in terms of syntax. Indentation-based syntax, for/while loops.
Pro Easy to integrate with another languages
You can use Nim with any language that can be interfaced with C. There's a tool which helps you to create new C and C++ bindings for Nim - c2nim.
You don't need to deal with all those manual memory allocations, Nim can take care of it. But also you can use another GC, or tweak it for your real-time application or a game.
Pro Compile-time execution
Nim has a built-in VM, which executes macros and some other code at compile time. For example, you can check if you're on Windows, and Nim will generate code only for it.
Pro Really cross-platform
The same code can be used for web, server, desktop and mobile.
Pro Built-in Unicode support
You can use unicode names for variables, there is "unicode" module for operations with unicode.
Pro Type interferencing
You only need to specify types in your procedures and objects - you don't need to specify type when you're creating a new variable (unless you're creating it without initialization).
Pro Multi paradigm
Imperative, OOP, functional programming in one language.
Pro Has built-in unittest module
With built-in "unittest" module you can create test with a very readable code.
Pro Supports UFCS (Unified Function Call Syntax)
writeLine(stdout, "hello") can be written as stdout.writeLine("hello")
proc add(a: int): int = a + 5 can be used like 6.add.echo or 6.add().echo()
Pro Has built-in async support
Nim has "asyncdispatch" module, which allows you to write async applications.
.NET offers rich functionality.
Pro 3rd Party support
Lot's of tools and libraries available.
Pro Visual Studio
The Visual Studio IDE offers one of the best development environments. The Community Edition can be used for free.
Pro Can be used in a variety of fields
with Xamarin for Mobile (ios, android)
with .net core asp for server (linux, windows)
with .net core for desktop (windows, mac)
with mono for desktop (windows, linux)
with blazor for web client with webassembly.
However, it is not considered top for any of those categories
top choice for windows desktop with .net framework
top choice for Unity
.net 5 will unify frameworks similar to JVM (just one)
Runs on Linux, Mac, and Windows
Can be designed visually with the Visual Studio designer for traditional Windows forms, WPF, or Web forms.
Pro It is a C like language.
Being a C like language counts in favor for it as a general purpose programming language, given the ease of using existing skills to pick up this language easily.
there are other superior languages that could be used as a general purpose, such as: F#, Haskell, but the complexity of those languages, being functional, make them strange to the usual C Syntax.
C# is better than C whenever garbage collection, Objects, classes, data access, are needed. But C is going to be the choice when hardware access and performance are paramount.
Con Learning curve
For a beginner the .NET framework can be daunting, the rich functionality means that things often can be done in several ways.
Con Microsoft will mess up with the Visual studio installation
And all of a sudden you'll need to reinstall the entire thing just because it stopped working.
Microsoft assumes that every workstation is connected to the Internet then it is always pushing updates.
Con Very large runtime
Cannot be used for embedded programming