D vs nim

Chris via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 20 02:44:58 PDT 2015


On Monday, 13 April 2015 at 17:28:14 UTC, Timothee Cour wrote:
> I think people interested in D should take a closer look at nim 
> and judge
> for yourself ; http://nim-lang.org/tut1.html is a good starting 
> point (docs
> in general are very well written).
>
> I went through their tutorials and here are some first 
> impressions:
>
> * nim is already bootstrapped (self-compiles)
> * feature set is very rich, many features (semantic and syntax) 
> not found
> in D or improving the ones in D, eg hygenic macros,
> * many key features of D (static if, type inference, CTFE, 
> UFCS, lambda,
> template constraints).
> * The syntax seems more orthogonal with fewer bultin constructs 
> and many
> generated by library, eg: 'a>b is a hygyenic macro that 
> generates 'b<a';
> associative arrays (tables) are in library
> * documentation in code uses markdown (less noisy than D's)
>  * named parameter arguments
> * tooling (nimble package manager ~dub, nimfix ~= gofix; 
> nimgrep ~=
> dscanner);
> * etc...
>
> less good or tradeoffs:
>
> * C backend instead of (LLVM,gcc or dmd's; but they're working 
> on it
> * uses yield-based ranges instead of D-based ranges (maybe 
> simpler to write
> but less efficient?)
> * forward declarations needed (docs says this may change)
> * thread-local GC (no stop the world)
> * RAII still experimental it seems
> * mutually importing modules seem possible; but doc says: 
> Modules that
> depend on each other are possible, but strongly discouraged; 
> it's very
> common in D
> * mutually recursive types. In Nim these types can only be 
> declared within
> a single type section. (Anything else would require arbitrary 
> symbol
> lookahead which slows down compilation.)
>
> not sure whether language has those; need to look more in the 
> docs:
> * delegates
> * template variadic (but has varargs[T])
> * not sure whether we can have template parameters which are 
> other than a
> type
>
> It would be nice to have a wiki page to describe this further 
> feature by
> feature. Many ideas would be great to incorporate in D too btw.
>
> On Fri, Apr 10, 2015 at 2:26 PM, bachmeier via Digitalmars-d <
> digitalmars-d at puremagic.com> wrote:
>
>> On Friday, 10 April 2015 at 18:52:24 UTC, weaselcat wrote:
>>
>>> The only things I've read about nim have been on the D forums 
>>> - it seems
>>> the wikipedia article is even being considered for deletion 
>>> due to not
>>> being noteworthy. So I think you might have trouble finding 
>>> any comparisons.
>>>
>>
>> Read the comments sections on other languages on Reddit 
>> programming and
>> you'll see their spam all over the place.
>>
>> I've never used Nim (and don't plan to because I've been 
>> turned off by
>> their constant spamming of comment threads on Reddit) but the 
>> numerous
>> comments I've seen repeatedly indicate that Nim is not yet 
>> ready for real
>> use.

I have to say, Nim sounds very interesting and promising. I don't 
know how easy it is to integrate C/C++ code, but they have a 
foreign function interface:

http://nim-lang.org/manual.html#foreign-function-interface


More information about the Digitalmars-d mailing list