Beauty is in the eye of the beholder. While clever, this is (IMO) far less understandable and more error-prone than say COBOL's positively ancient built-in SEARCH ALL binary search statement. Here's an example of a 3-key binary table search from IBM's COBOL documentation that includes options for found and not found conditions.<p><pre><code> SEARCH ALL TABLE-ENTRY
AT END PERFORM NOENTRY
WHEN KEY-1 (INDX-1) = VALUE-1 AND
KEY-2 (INDX-1) = VALUE-2 AND
KEY-3 (INDX-1) = VALUE-3
MOVE PART-1 (INDX-1) TO OUTPUT-AREA
END-SEARCH
</code></pre>
<a href="https://www.ibm.com/docs/en/cobol-zos/6.1?topic=all-example-binary-search" rel="nofollow">https://www.ibm.com/docs/en/cobol-zos/6.1?topic=all-example-...</a>
D is a refreshing language in the sea of "alternative to C languages", they didn't reinvent the syntax, so if you come from C, using D will feel very natural and at home! (and you'll be protected from most unsafe/ub quirks of C)<p>When it comes to metaprogramming, it's excellent, but it is a double edged sword, it can be useful, but if abused it'll tank your build speed, so one must find a proper balance to avoid pain later<p>One of the few languages that offers its own backend! (LLVM/GCC backends are also available)<p>I love this level of independence, a real labor of love, one of the best better C, i'd even say this is the evolution C needed
Unless I am missing something, you can just use .length on a static array:<p><pre><code> int[5] a = [1,2,3,4,5];
writeln(a.length); // 5</code></pre>
Reminds me of <a href="https://en.wikipedia.org/wiki/Successive-approximation_ADC" rel="nofollow">https://en.wikipedia.org/wiki/Successive-approximation_ADC</a>
D is the systems language I enjoy writing the most out of C++, Rust, and Go.<p>It feels a lot like a mix between C# and JS, but at the low level access of C++.<p>It has a lot of unique features but the "killer feature" by far for me is Contract Programming and Invariants<p><a href="https://tour.dlang.org/tour/en/gems/contract-programming" rel="nofollow">https://tour.dlang.org/tour/en/gems/contract-programming</a><p>Invariants changed my life, so much so that I built a GCC plugin to add them to C++<p>It used to be the case that the developer tooling wasn't very good, but the "code-d" VS Code plugin has matured greatly in the last few years and has some features you won't find even in bigger languages<p>(Like the ability to colorize source code lines with GC profiling info or test coverage status)<p>---<p>Another useful bit of info is that AddressSanitizer and tools like LLVM libFuzzer work with the LDC compiler