D and Nim

Ary Borenszweig via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 4 18:11:03 PST 2015


On 1/4/15 8:17 PM, anonymous wrote:
> On Sunday, 4 January 2015 at 21:46:09 UTC, Ary Borenszweig wrote:
>> On 1/4/15 3:10 PM, Jonathan wrote:
>>> Hey folks,
>>>
>>> I've been recently checking out Nim/rod and feel like it takes a lot of
>>> inspiration from D (I think the creator was in the D community too as
>>> some point). How do you think it compares? What areas does D, in
>>> principle, makes it a better choice? To give you my background, I like
>>> creating games (mostly using SDL bindings) using new languages, aiming
>>> for the most efficient yet concise way to write the engine and game
>>> logic.
>>>
>>> FYI, this is NOT a language war thread. I'm just curious about what
>>> separates them from a principle level.
>>
>> In my opinion Nim is superior than D in every aspect (and I say this
>> as my personal opinion, not to trigger a language war).
>
> You do want a language war because your spewing too much
> bullshit. I dabbled in both d and nim/rod. All interesting in nim
> is whats taken from d.

As I said, it's just my personal opinion. Others have said D is superior 
to Nim and they gave their reasons.

>
>> There are examples of D code in these two repos:
>>
>> https://github.com/logicchains/LPATHBench
>> https://github.com/kostya/benchmarks
>>
>> Take a look at for example the first one in D and Nim:
>>
>> https://github.com/logicchains/LPATHBench/blob/master/d.d
>> https://github.com/logicchains/LPATHBench/blob/master/nim.nim
>>
>> According to the writeup:
>>
>> https://github.com/logicchains/LPATHBench/blob/master/writeup.md
>>
>> Nim is faster than D. And it does so with much less code.
>
> Bullshit. dmd is easy to beat. also json parsing? library issue.
>
>> Then look at kostya/benchmarks: D is always behind Nim (except matuml,
>> where they are similar, but all statically compiled languages are
>> similar in that one). And Nim's code is always shorter and cleaner.
>> (and before you reply to this with "but if you add pure nothrow @safe
>> @abracadabra", continue reading)
>
> Bullshit. Main differences are nim has significant whitespace.
> Code looks shorter because theres less {}. Second difference is
> nim has code at top level. Great for short benchmarks but aweful
> in large code.

I actually meant all those annotations (pure nothrow safe immutable 
final) that appear every time someone ones to get their code run fast.

>
>> There was a time I liked D. But now to make the code fast you have to
>> annotate things with pure nothrow @safe to make sure the compiler
>> generates fast code. This leads to code that's uglier and harder to
>> understand.
>
> Bullshit. That stuff makes d more modular than nim.

How "pure nothrow @safe" make things more modular?

>
>> Another point is that Nimrod has CTFE but does so with a virtual
>> machine, so I'm sure it's faster than D in that aspect.
>
> How does that make the language superior? Bullshit again.

Many have complained that CTFE can take about 2 gigs of memory so they 
can't compile their programs (I think related to vibe.d templates). If 
that memory was garbage collected there would be no problem. Of course, 
DMD can have a GC, Walter said it before, but it slowed down things. Nim 
compiles itself in 2.5~5 seconds with a GC on (I think, please correct 
me if this is wrong). In any case Crystal compiles itself in about the 
same time with a GC on, so disabling a GC for speed shouldn't be an excuse.

>
>> Then, Nim is written in Nim.
>
> How does that make the language superior? Bullshit again.
>
>> Having the compiler be written in itself is a good way to immediately
>> have the developers of the language get the feeling of the language,
>> find bugs and improve it.
>
> ddmd

But the main D developers are using dmd, written in C++. I'm not sure 
they have written large D programs, as big as a compiler (but correct me 
if I'm wrong). Having a compiler written in D can make things more 
stable, and authors can improve the language as they get immediate 
feedback. At least that's how I feel it when I develop Crystal.

>
>> Nim has 363 issues accoring to https://github.com/Araq/Nim/issues . D
>> has 2444 according to
>> https://issues.dlang.org/buglist.cgi?component=DMD&limit=0&order=bug_status%2Cpriority%2Cassigned_to%2Cbug_id&product=D&query_format=advanced&resolution=---
>>
>
> Bullshit. Thats nimrod is less popular than dmd. Jesus i cant
> believe you can smoke that.

You might be right, I didn't think of that.

>
>> . Also, because the compiler is written in itself, everything is
>> garbage collected, so there are no worried when doing CTFE (D's CTFE
>> consumes a lot of memory, I read in this newsgroup). Nim compiles
>> itself in between 2.5 and 5 seconds.
>
> How does that make the language superior? Bullshit again.
>
>> Also, I get the feeling that D has too many features and not all of
>> them work in harmony with the rest of them. So people always find
>> small bugs and others suggest workarounds and eventually people learn
>> to program in a WDD way (Workaround-development-driven).
>
> Also, I get the feeling your bullshitting through your ears.
>
>> Back to LPATHBench, I find things like minimallyInitializedArray and
>> uninitializedArray, which are great for optimizing things, but it's
>> sad that one has to use these special functions instead of regular
>> ones (idiomatic code) to achieve better performance. Also,
>> "uninitialized" sounds unsafe... And then you must compile your code
>> with -noboundscheck to get more performance, but that's so unsafe...
>
> Bullshit.

Well, at least give me a reason why most people here recommend compiling 
with -noboundscheck to get optimal code.

>
>> But then, both D and Nim have things which I dislike: too many
>> built-in things. Static arrays, arrays, sequences, etc. Can't these be
>> just implemented in D/Nim? Why the need for special built-in types
>> with special operations?
>>
>> Anyway, just my opinion :-)
>
> Just a load of bullshit.

Maybe.


More information about the Digitalmars-d mailing list