September 21, 2020
On Monday, 21 September 2020 at 21:26:26 UTC, data pulverizer wrote:
> **As I said, I think Nim is a fantastic language**, but as a data scientist, there are certain things I expect from standard libraries in modern languages. One of them is being able to easily write and run code like the example threaded kernel matrix calculation using either elements from the base or standard library. That is pretty basic to me.

Well so get rid of that requirement. If it can be built as a library, that's a *strength* of a language. ;-)
September 21, 2020
On Monday, 21 September 2020 at 11:04:43 UTC, Imperatorn wrote:
> Top reasons to use D instead of for example Rust, Julia, Go etc :)

1. In C and C++, you have to define the size of the array. In D, you can just leave the brackets empty.
2. You can return an array directly. In C and C++, you would have to return a pointer to an array:

int* return_int_array() {
int* ret = new int[3];
return ret;
}
3.The foreach loop. Just iterates over things. You could also use a for loop in place of this, but writing out a foreach loop is shorter and is easier to read.

4.  Mixins. These allow mixing in strings into the code. These are not in C or C++.

Completely unrelated, but is this code valid?

import std.string;
import std.stdio;
T someTemplate(T) () {
//function template
}

void main(){
string template_type;
strip(readln(data));
mixin("someTemplate!" ~ data ~ "()");
}

September 21, 2020
On Monday, 21 September 2020 at 22:18:44 UTC, Ruby The Roobster wrote:
> Completely unrelated, but is this code valid?
> strip(readln(data));
> mixin("someTemplate!" ~ data ~ "()");


Nope, all the data for mixin must be known by the compiler and thus cannot depend on any run time value.


September 22, 2020
On Monday, 21 September 2020 at 11:04:43 UTC, Imperatorn wrote:
> Top reasons to use D instead of for example Rust, Julia, Go etc :)

Easy meta-programming, ranges, and all the features that support them, changed my life to the extent that I've concluded that we must spread Mars' glory to the impoverished and emaciated programmers who wallow in programming's drudgery. Yes, they will resist. And yes, they will despise we who bring peace to their weathered souls. It will be difficult--possibly insurmountable--yet through great works and many a blog post, even the most inveterate among them will capitulate to Mars' gift of productivity, extensibility, and pacification. All hail Mars!


September 22, 2020
On Monday, 21 September 2020 at 21:50:40 UTC, Araq wrote:
> Well so get rid of that requirement. If it can be built as a library, that's a *strength* of a language. ;-)

Nice try.
September 22, 2020
On Tuesday, 22 September 2020 at 06:41:23 UTC, data pulverizer wrote:
> On Monday, 21 September 2020 at 21:50:40 UTC, Araq wrote:
>> Well so get rid of that requirement. If it can be built as a library, that's a *strength* of a language. ;-)
>
> Nice try.

Or you use the builtin '||', it works.

September 22, 2020
On Tuesday, 22 September 2020 at 06:53:56 UTC, Araq wrote:
> On Tuesday, 22 September 2020 at 06:41:23 UTC, data pulverizer wrote:
>> On Monday, 21 September 2020 at 21:50:40 UTC, Araq wrote:
>>> Well so get rid of that requirement. If it can be built as a library, that's a *strength* of a language. ;-)
>>
>> Nice try.
>
> Or you use the builtin '||', it works.

Thanks will check it out and update the article to include Nim (hopefully in the next few weeks - a little busy at the moment). Thanks for the tip.
September 22, 2020
On Monday, 21 September 2020 at 11:04:43 UTC, Imperatorn wrote:
> Top reasons to use D instead of for example Rust, Julia, Go etc :)

most of my upsides are compared to C++, but not all.

- good compatibility with C libraries and similarity to C/C++ code. You can copy paste C++ snippets to D and they work with minor changes

- GC with value types

- compile time reflection

- well working package manager

- friendly, helpful community

- batteries included standard library (xml, json)
September 22, 2020
On Monday, 21 September 2020 at 11:04:43 UTC, Imperatorn wrote:
> Top reasons to use D instead of for example Rust, Julia, Go etc :)


I tend to pick languages due to eco-systems, so there isn't much I would pick D for, given the work I do, however I would still like to place a general list of D's pros.


- As mentioned on the other thread, great community;

- It is what Java 1.0 and C# 1.0 should have been all along and are still trying to catch up with (20 - 25 years later). There are AOT solutions like .NET Native, but with caveats;

- A tracing GC with support for value types in the tradition of system languages like Mesa/Cedar, Modula-3, Oberon and descendants

- Powerful metaprogramming capabilities

- Generics

- Modules

- Even if not fully supported (I know there is work in progress), D experience to generate WebAssembly via ldc is much better than having to deal with emscripten
September 22, 2020
On Tuesday, 22 September 2020 at 19:24:30 UTC, Paulo Pinto wrote:
> On Monday, 21 September 2020 at 11:04:43 UTC, Imperatorn wrote:
>> [...]
>
>
> I tend to pick languages due to eco-systems, so there isn't much I would pick D for, given the work I do, however I would still like to place a general list of D's pros.
>
> [...]

True, I've tried CoreRT for .NET and it's not seamless.