News for hackers. Stuff that matters.
Re:Why Use Nim over C#? by Idiot_in_Vain on Wednesday March 01, 2023 @05:13AM (#34980679)
There are literally millions of professional developers using C#. Any problem you run into has a solution documented online.

Languages like Nim are a good choice for developers who need the adrenaline rush of dealing with complicated problems alone.

Re:Why Use Nim over C#? by oynqr on Wednesday March 01, 2023 @05:41AM (#34980838)
Damn, didn't know C# can solve the halting problem.
Re:Why Use Nim over C#? by osivat on Wednesday March 01, 2023 @06:14AM (#34981079)
Of course it can, this simple feature has been in Visual Studio Enterprise for more than a year.
Re:Why Use Nim over C#? by guilhas on Wednesday March 01, 2023 @06:03AM (#34981001)
The problem with the c#/dotnet ecosystem is there are too many answers online for different versions

c#, records, EF6, EF core, EF7, net4.8, net standard, net core, net6, webforms, blazor, web api, web mvc, razor, identity core, legacy, UI, dotnet cli, visual studio, vscode, nuget, CMD, powershell...

Re:Why Use Nim over C#? by koenvdb on Wednesday March 01, 2023 @06:14AM (#34981078)
Most of the time the answers are interchangable. There are a few exceptions but then you just look for "Specific problem .Net6" for example.
Re:Why Use Nim over C#? by jackmott42 on Wednesday March 01, 2023 @06:30AM (#34981164)
you listed 3 versions of C# in that list, and they are all as similar as versions of any other language are.
Re:Why Use Nim over C#? by rjh29 on Wednesday March 01, 2023 @06:11AM (#34981052)
What is better, too many options or barely any?
Re:Why Use Nim over C#? by guilhas on Wednesday March 01, 2023 @12:15PM (#34984993)
For an experienced c#/.net it is OK, but new developers might get confused and go learn another language

Nim looks very clean. But I am not sure it is ready for complex production work

Re:Why Use Nim over C#? by sebazzz on Wednesday March 01, 2023 @10:13AM (#34983233)
I bet you I'll love any library in Node.js or the ecosystem itself. That's significantly worse.
Re:Why Use Nim over C#? by silon42 on Wednesday March 01, 2023 @06:10AM (#34981045)
It's more or less true for Java... but in my experience, less true for c#.
Re:Why Use Nim over C#? by Santosh83 on Wednesday March 01, 2023 @05:41AM (#34980845)
> But if you use windows, there is no inline assembly so shrug.

(in Nim presumably)

Can anyone say why?

Re:Why Use Nim over C#? by DeathArrow on Wednesday March 01, 2023 @05:30AM (#34980784)
I currently use C# for most of my work. I would love to use Nim, as I like its design, its simplicity, its performance and the fact that it doesn't enforce OOP, but here are the problems:

-not enough libraries

-not enough frameworks

-not enough support

Re:Why Use Nim over C#? by cosmicradiance on Wednesday March 01, 2023 @05:42AM (#34980852)
above 3 boils down to - not enough enterprise backing
Re:Why Use Nim over C#? by was_a_dev on Wednesday March 01, 2023 @05:31AM (#34980785)
Classic chicken and egg
Re:Why Use Nim over C#? by dmitriid on Wednesday March 01, 2023 @05:49AM (#34980898)
Re:Why Use Nim over C#? by WithinReason on Wednesday March 01, 2023 @05:32AM (#34980794)
I didn't realize you can mix Nim an Assembler like this:

https://github.com/mratsim/constantine/blob/1cb6c3d/constant...

Re:Why Use Nim over C#? by xupybd on Wednesday March 01, 2023 @05:14AM (#34980686)
Does Nim really have no competition in the meta programming space? I assumed Haskell would do well there?
Re:Why Use Nim over C#? by jb1991 on Wednesday March 01, 2023 @05:19AM (#34980724)
Also zig, meta programming is one of its key features from what I understand.
Re:Why Use Nim over C#? by kitd on Wednesday March 01, 2023 @05:24AM (#34980758)
D too. D templates are dangerously easy to use.
Re:Why Use Nim over C#? by jb1991 on Wednesday March 01, 2023 @10:53AM (#34983663)
Why dangerous?
Re:Why Use Nim over C#? by kitd on Wednesday March 01, 2023 @12:12PM (#34984940)
Template metaprogramming facilities have a reputation for being a very powerful tool if used judiciously. If overused, they can lead to over-complexity though. And a template system that is as easy to use as D's might encourage overuse.
Re:Why Use Nim over C#? by rakoo on Wednesday March 01, 2023 @05:25AM (#34980767)
ruby is notorious/famous for monkeypatching everything and the simplicity of creating DSLs
Re:Why Use Nim over C#? by freilanzer on Wednesday March 01, 2023 @06:12AM (#34981061)
Presumably you're only asking about statically typed languages, right? Otherwise Julia, and every Lisp come to mind. Especially compared to Lisp all other languages are inferior when it comes to meta programming.
Re:Why Use Nim over C#? by francisl on Wednesday March 01, 2023 @03:05PM (#34987534)
swift and kotlin are slowly getting there.
Re:Why Use Nim over C#? by bilekas on Wednesday March 01, 2023 @05:14AM (#34980685)
> but i do like how nim programs consistently have few lines of code than the same program in really most other languages which seems like a good thing

Interesting take.. I could share some codeGolf languages that you might like to play with in that case!

That said there are a few fallacies in the comments also that bother me a bit. Specifically the assumption that 'once its closer to C its automatically more performant.'

Wild comments too like : `Nim runs on many more platforms than C#`

Without being specific this claim is just weird..

> beware though that usually the people who wrote the benchmarks might not be experts on Nim

So you need to be an expert to benchmark it.. Red flag.

Re:Why Use Nim over C#? by shaunsingh0207 on Wednesday March 01, 2023 @05:35AM (#34980806)
I didn't get why fewer lines of code is better. I don't choose rust because its "shorter", far from it, if anything I choose rust because its very verbose with its syntax, but that syntax conveys a lot of information.

Another comment in the above thread mentioned that "c-like performance is easily reachable with c2nim, or inline assembly" well then thats not really the performance of nim is it, thats the performance of assembly ...

Re:Why Use Nim over C#? by dmitriid on Wednesday March 01, 2023 @05:51AM (#34980918)
> I didn't get why fewer lines of code is better.

There have been a few studies showing that bugs-per-line-of-code is pretty consistent from language to language. So, if you can reduce the number of lines needed, you reduce the number of bugs.

There are also surely diminishing returns

Re:Why Use Nim over C#? by shaunsingh0207 on Wednesday March 01, 2023 @06:22AM (#34981120)
I'd bet rust is an outlier in that, a lot of languages require more code to do the same things, as a result of being simpler langs (lua). a lot of langs are very easy to shoot yourself with, more lines means more oppurtinity to shoot yourself.

In rust though, that 30 line python script probably takes 45 lines to write now. But those 15 lines aren't wasted or because of longer logic, rather those lines are used to convey type information

its not "more lines = more bugs" as it is "most languages don't put more lines to good use"

Re:Why Use Nim over C#? by planetis on Wednesday March 01, 2023 @12:54PM (#34985704)
I would find it easier to believe if 1. there was a sample, 2. you claimed that the extra 15 lines are just {} indentation. Btw here is the same build script in nim https://github.com/planetis-m/raylib-game-template/blob/mast... and in python https://gist.github.com/planetis-m/a437db724185215910a59c3b3... Which is shorter/more readable?

Note I could have used f-strings for both, I just don't like how they are rendered in my editor.

Re:Why Use Nim over C#? by Ygg2 on Wednesday March 01, 2023 @07:38AM (#34981692)
Correlation is not causation.

E.g. more cells means more cancer per 100k cells, right? Incorrect. Different species have different rates of cancer.

Re:Why Use Nim over C#? by Octoth0rpe on Wednesday March 01, 2023 @05:55AM (#34980948)
This is a pretty dumb/blunt justification, but there is _some_ truth to it: The number of bugs in a program correlates roughly to the number of lines in that program, irrespective of language. Ergo, if some language lets you accomplish your goal in 30% fewer lines, you will have 30% fewer bugs.

The huge caveats are at a minimum that you're writing the code idiomatically (ie not putting your entire program on a single line), that it also strongly depends on developer proficiency with the language (likely lower for a newer language like nim), whether the problem you're solving is well understood, etc

Re:Why Use Nim over C#? by jackmott42 on Wednesday March 01, 2023 @06:34AM (#34981205)
There is a lot of data showing less lines of codes correlates with less bugs. I don't know if that works cross languages, like a language that requires annotations to help ensure correctness requires more lines thus does it correlate with fewer bugs than python? don't know.

but nim and C# have similar levels of safety

Re:Why Use Nim over C#? by kitd on Wednesday March 01, 2023 @05:22AM (#34980742)
Not an expert, but your comparisons need to be apples-to-apples. An expert-tuned C# impl v a naive Nim impl isn't a good benchmark.
Re:Why Use Nim over C#? by bilekas on Wednesday March 01, 2023 @05:27AM (#34980772)
If I'm benchmarking (not perf testing) a language with some nuances I'm not too familiar with, I would stick some simple implementations of core workings. If those simple tasks are `supposed` to be done a `special` way, then I'm already not interested.

Why should I need to learn semi-workarounds just to achieve the basics.

Re:Why Use Nim over C#? by WithinReason on Wednesday March 01, 2023 @05:28AM (#34980779)
How many algorithms don't benefit from optimisations you think?
Re:Why Use Nim over C#? by bilekas on Wednesday March 01, 2023 @05:35AM (#34980809)
Of course, but this is not the point of a benchmark test though - Mainly because as above you want that Apples to Apples comparison.

I think I might not have explained my position too well.

Re:Why Use Nim over C#? by jb1991 on Wednesday March 01, 2023 @05:17AM (#34980710)
You can write fast or slow code in any language, typically people who understand the language very well are the ones who can write performant code, regardless of language. All those benchmark games out there for dozens of languages are proof of that.
Re:Why Use Nim over C#? by gigatexal on Wednesday March 01, 2023 @05:20AM (#34980729)
For game dev? Use C#. It’s got all the bindings to the engines and other such things you’ll need.
Re:Why Use Nim over C#? by toastal on Wednesday March 01, 2023 @05:22AM (#34980745)
You can use F#, but this implores that we get more engines if all they are compatible with is Microsoft .NET.
Re:Why Use Nim over C#? by initplus on Wednesday March 01, 2023 @05:37AM (#34980819)
F# is a great language, but it somewhat waters down its strengths to bolt it to a giant hulking lump of C++ full of mutable state. Interacting with an impure api means throwing out many of the advantages of (mostly) pure programming.
Re:Why Use Nim over C#? by pjmlp on Wednesday March 01, 2023 @05:26AM (#34980769)
And even then, don't forget that from .NET team's point of view, F# is a community language that gets to be on .NET SDK.
Re:Why Use Nim over C#? by waldarbeiter on Wednesday March 01, 2023 @05:14AM (#34980681)
Conclusion: Don't trust people who highly discourage you to learn C++.
Re:Why Use Nim over C#? by p0nce on Wednesday March 01, 2023 @05:42AM (#34980850)
Unfortunately the cost of learning C++ has increased.
Re:Why Use Nim over C#? by waldarbeiter on Wednesday March 01, 2023 @05:53AM (#34980938)
Totally agree, my comment certainly was provocative but OP mentioned that he "still want to learn it anyway because so much stuff is built with c++ and also because i just want to" after he got discouraged to learn C++. And I think with that in mind he should just start learning C++ and make his own experience with the language.
Re:Why Use Nim over C#? by jb1991 on Wednesday March 01, 2023 @05:20AM (#34980730)
That’s a silly conclusion to draw. Plenty of high profile, well-known, expert C++ developers have made similar recommendations in recent years and are even working on alternate languages.
Re:Why Use Nim over C#? by hardware2win on Wednesday March 01, 2023 @05:16AM (#34980704)
Be honest with yourself

CPP ecosystem is far from being sane in compare to e.g Rust.

Re:Why Use Nim over C#? by saidinesh5 on Wednesday March 01, 2023 @05:32AM (#34980790)
In my experience, there's no such thing as cpp ecosystem... What there are, are many little ecosystems that revolve around various subsets of the giant language called C++. And they tend to range from quite fun to use to living nightmares/walking zombies...

For eg, if you just stick to Qt/C++/QML ecosystem for making GUI/Embedded apps, the libraries are quite good, the developer tooling is quite nice, you never even leave your IDE. Infact it is nicer than what Rust has to offer for GUI today. However, if you want to make webapps/services with C++, my experience has been death by thousand cuts. I have heard similar stories from developers coming from Windows/VC++. For a lot of them, cross platform portability isn't a thing to worry about. A lot of them just store compiled dlls and header files of their dependencies in their repos etc...

Re:Why Use Nim over C#? by pjmlp on Wednesday March 01, 2023 @05:25AM (#34980766)
While it has lots of warts, and no matter what it won't ever be Rust like safe, Rust still has 40 years of libraries, IDEs and tooling to catch up to.

And until it gets bootstrapped, it will have a dependency on C++ compiler infrastructure.

Re:Why Use Nim over C#? by bilekas on Wednesday March 01, 2023 @05:20AM (#34980732)
Care to elaborate further on that ? Not sure what you mean about CPP 'ecosystem' being far from sane.
Re:Why Use Nim over C#? by hardware2win on Wednesday March 01, 2023 @06:50AM (#34981307)
Bilion build systems, package managers, compilers, test frameworks, etc etc

You change company and you have to relearn all boring tools

Re:Why Use Nim over C#? by pictur on Wednesday March 01, 2023 @05:18AM (#34980722)
are you serious with this comment or is it a joke?
Re:Why Use Nim over C#? by hardware2win on Wednesday March 01, 2023 @06:51AM (#34981322)
Very serious
Re:Why Use Nim over C#? by mlatu on Wednesday March 01, 2023 @05:49AM (#34980896)
I agree, being discouraged from using a more powerful tool should be reason to pause.. too bad OP didnt elaborate on that bit

allthough... i can see reasons to avoid c++ in favour of other (systems) plangs but ultimately you will use whatever the team uses :D

Re:Why Use Nim over C#? by cardanome on Wednesday March 01, 2023 @06:10AM (#34981047)
As a young lisp-weenie I have done my fair share of C++ bashing that I now regret so maybe it is just the arrogance of youth but still I kind of feel sad about the toxic attitudes in certain system programming languages communities (looking at you Rust) against the "competition".

If nothing else, C++ is worth a look for its excellent libraries that will not be replaced anytime soon.

It is great to see that the Nim community is more pragmatic and level-headed.

Re:Why Use Nim over C#? by cardanome on Wednesday March 01, 2023 @05:50AM (#34980901)
C# is an excellent language with an great ecosystem and lots of jobs available. Also, if you ever want to go a bit more functional, F# is excellent.

My personal reason for avoiding it is purely political: I don't trust Microsoft. I try to not rely on languages that are controlled by a single monopolistic corporations. Considering the recent case of the golang compiler planning on getting telemetry, I feel validated in that decision.

As for game development, I think the game engine of choice will already dictate what one should learn.

Unity is still king of casual and mobile games, so if that is your niche, learning C# is a no-brainer. Plus Godot has decent C# support now, if you ever need to change horses.

As for more complex 3d games, Unreal 5 is just insanely good. Nanite and Lumen offer tremendous improvements in both development experience and end result. Here learning some C++ is advised but funny enough, there are actually Nim bindings as well. If you don't mind getting into somewhat untested waters, Nim might be a very good choice here.

Re:Why Use Nim over C#? by deafpolygon on Wednesday March 01, 2023 @06:08AM (#34981037)
> Considering the recent case of the golang compiler getting telemetry

Is this for certain? I thought this was still in the discussion phase.

Re:Why Use Nim over C#? by cardanome on Wednesday March 01, 2023 @06:19AM (#34981106)
I should have phrased that as "planning to".

After the significant push-back it seems like are considering doing only opt-in telemetry[1] which would be acceptable.

So not that bad for now but who knows. Once telemetry is in place, they might try to change it to opt-out at a later date when less push-back is expected. Still setting a problematic precedent and shows why corporate control about a programming language might become problematic.

[1] https://research.swtch.com/telemetry-opt-in

Re:Why Use Nim over C#? by pjmlp on Wednesday March 01, 2023 @08:44AM (#34982291)
When those corporations not put the money into the work, even free beer C and C++ compilers suffer, see clang current state of ISO support.
Re:Why Use Nim over C#? by brudgers on Wednesday March 01, 2023 @10:00AM (#34983108)
Not trying to change your politics. People hate Microsoft for many reasons.

C# has an ECMA standard (334).

I.E. it has a public specification.

Some versions also have an ISO Standard.

https://www.ecma-international.org/publications-and-standard...

Re:Why Use Nim over C#? by sebazzz on Wednesday March 01, 2023 @10:14AM (#34983249)
> I try to not rely on languages that are controlled by a single monopolistic corporations

Only languages or frameworks too? Because there aren't many which aren't controlled by a single entity. Sometimes it is just not that obvious.

Re:Why Use Nim over C#? by scotty79 on Wednesday March 01, 2023 @05:54AM (#34980943)
My main reason for using C# is that's it's nice enough but Visual Studio feels amazing.
Re:Why Use Nim over C#? by diarrhea on Wednesday March 01, 2023 @06:32AM (#34981176)
I have the opposite stance. Visual Studio is my primary dislike in working with C#. It's mighty, I'll give it that. The debugging experience is strong. But it's slow, sluggish, components or itself crash sporadically; the extension ecosystem isn't great.

Working with containers/docker is a bit painful, too: as with all things Microsoft, there are layers of indirection to just make it work™. While it does, it's wonderful. Almost inevitably however, one runs into edge cases that are impossible to solve, because the config you need hasn't been surfaced to the GUI. That's where I prefer more 'hackable' IDEs like VSCode. In these situations, it might just allow you to drop a line of bash into some JSON config. Simple and works, no GUI work from the devs required.

One my of favorite pet peeves is running unit tests in parallel from inside VS, using the GUI/shortcuts. The setting for running unit tests in parallel is a nested setting, only accessible via GUI. Running unit tests in sequence is incredibly slow in our case (and when would you ever want unit tests _not_ run in parallel?). The setting is then stored somewhere in the `.vs/` directory, in _binary files_. You cannot version control them, and `git clean` regularly knocks that directory out, wiping the setting. Annoying, but not annoying enough to do anything about!

Re:Why Use Nim over C#? by _hao on Wednesday March 01, 2023 @07:15AM (#34981512)
I agree with you around VS and I use it all the time. The problem is that Rider for example is the same. I've had the chance to do a project with Rider recently and I have to say performance-wise both VS and Rider are just slow and prone to crashes and random errors. It's true they offer immense power. Debugging and profiling is unmatched in both IDEs. However, what I'd like is a more modular approach in both of them where I can disable certain things to take a load off the dev experience. I'm not sure if their architecture would allow for such a change, but I'd love to see it.

I'm back to my usual VSCode setup now for .NET/C# work, but there even though I have more than 50 extensions, they are all enabled on per-project basis so the experience is pretty light. I still have to boot up VS/Rider from time to time, but it won't be my first choice.

Re:Why Use Nim over C#? by AdrianB1 on Wednesday March 01, 2023 @06:06AM (#34981021)
Stupid question of the week that came to me after reading this: is there any language that compiles to dot net intermediate language, so it runs on do net like C# but with a different syntax like Nim? There are advantages and disadvantages, I am just curious if anyone wanted to go this way.
Re:Why Use Nim over C#? by ifdefdebug on Wednesday March 01, 2023 @06:11AM (#34981057)
Take a look at F#
Re:Why Use Nim over C#? by AdrianB1 on Wednesday March 01, 2023 @06:47AM (#34981289)
F# is also Microsoft, is it? I am thinking about third parties that want to use the dot net ecosystem with their own languages.
Re:Why Use Nim over C#? by freilanzer on Wednesday March 01, 2023 @06:11AM (#34981053)
F#?
Re:Why Use Nim over C#? by dvdkon on Wednesday March 01, 2023 @06:14AM (#34981075)
There's one area where Nim is better than most alternatives, especially those with a separate required runtime, and that is binary size. I write quick scripts and daemons with Nim, knowing that they won't take up space on my disk or in RAM.
Re:Why Use Nim over C#? by DeathArrow on Wednesday March 01, 2023 @06:28AM (#34981158)
Also, this might be an interesting read: https://mode80.github.io/7-langs-in-12-months.html