D

Beautiful

module mergesort;import std.traits : isOrderingComparable, isCopyable, isMutable, isArray;import std.algorithm.sorting : isSorted;private void merge(T)(ref T[] arr, ref T[] aux, in ulong lo, in ulong mid, in ulong hi) if (isOrderingComparable!T && isCopyable!T && isMutable!T)in{ debug { assert(arr[lo .. mid].isSorted); assert(arr[mid .. $].isSorted); }}out{ debug { assert(arr.isSorted); }}do{ // WARN: UNTESTED debug { assert(arr.length == 0); } foreach (ulong i; 0 .. arr.length) aux ~= arr[i]; ulong left = lo, right = mid; foreach (ulong i; lo .. hi + 1) { if (aux[mid] < aux[mid + 1]) { arr = aux; break; } if (aux[left] < aux[right]) { arr[i] = aux[left++]; } else if (aux[right] mid) { arr[i] = arr[right++]; } else { arr[i] = arr[left++]; } }}

Attached: PeMSYqY.png (1024x1024, 21.9K)

Other urls found in this thread:

cvedetails.com/vulnerability-list/
twitter.com/NSFWRedditVideo

But c++ lets me plug a custom allocator into any standard data structure. Can D do that?

I tried D in the past but got demotivated so never learned it fully. From the little that I used it it's a better language than C++: the well designed library, the built in strings, arrays and maps, all make it a very elegant and practical language... which unlike C++ is actually high level. Then again for C++ weenies anything above machine code is "high level", even assembler.

Anyway back to D, unfortunately they refuse to standardize it by way of ISO/IEC, because who needs standardization amirite? "Other languages do just fine without standardization." Yeah because they're backed by big corporations, big money, maybe even a government.

Ultimately, the philosophical problem of D is that in order to fully appreciate it you need to be an above-average C++ programmer in the first place. But if you already are, why the fuck would you leave standard C++ for what is basically an unproven language? Methinks toying around with D as if it was a hobby project (which it is) should end immediately, and the language standard should freeze its features in, let's say, ISO/IEC D20, in time to poop on C++20's party. But that's not going to happen because suddenly winning over C++ programmer's isn't the goal anymore... the goal now is having fun or whatever.

Why post this in Zig Forums instead of /prog/?

Maybe he wanted someone to read it. But it's just the new meme to push D after he got bored pushing Rust. They're both toy languages. People gave up hope for D before many anons were born so it's an unusual choice.

Rust is already synonymous with "meme shit", but D is more unheard of and more similar to C++ so it's easier to push without getting instantly filtered.

What were the reasons? I am curious because I haven't followed D history closely.

I feel like even just reading it requires too big investment. Even perl scripts aren't that hard to read once you get basic grasp of arrays, hashes, () magic and $_.

What is a `toy language`?

And what is a `meme shit`?