Live data from Hacker News

Beautiful Binary Search in D

muscar.eu

1–10 of 62 posts

Re: Beautiful Binary Search in D

#4
D is the systems language I enjoy writing the most out of C++, Rust, and Go.

It feels a lot like a mix between C# and JS, but at the low level access of C++.

It has a lot of unique features but the "killer feature" by far for me is Contract Programming and Invariants

https://tour.dlang.org/tour/en/gems/contract-programming

Invariants changed my life, so much so that I built a GCC plugin to add them to C++

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

(Like the ability to colorize source code lines with GC profiling info or test coverage status)

---

Another useful bit of info is that AddressSanitizer and tools like LLVM libFuzzer work with the LDC compiler

Re: Beautiful Binary Search in D

#6
post #4

D is the systems language I enjoy writing the most out of C++, Rust, and Go. It feels a lot like a mix between C# and JS, but at the low level access of C++. It has a lot of unique features but the "killer feature" by far for me is Contract Programming and Invariants https://tour.dlang.org/tour/en/gems/contract-programming Invariants changed my life, so much so that I built a GCC plugin to add them to C++ It used to…

Is your gcc plugin a personal project or something you built for a team ? I find the idea brilliant in itself but I wonder if other people felt the need, and uses / enjoy this kind of improvements.

I want to add profile/coverage info in emacs now :)

D is a strange point in PL landscape, it's been here for ages, never took off (for some value of taking off) even though it seems there's a lot to like.

Re: Beautiful Binary Search in D

#7
post #4

D is the systems language I enjoy writing the most out of C++, Rust, and Go. It feels a lot like a mix between C# and JS, but at the low level access of C++. It has a lot of unique features but the "killer feature" by far for me is Contract Programming and Invariants https://tour.dlang.org/tour/en/gems/contract-programming Invariants changed my life, so much so that I built a GCC plugin to add them to C++ It used to…

Is your gcc plugin a personal project or something you built for a team ? I find the idea brilliant in itself but I wonder if other people felt the need, and uses / enjoy this kind of improvements. I want to add profile/coverage info in emacs now :) D is a strange point in PL landscape, it's been here for ages, never took off (for some value of taking off) even though it seems there's a lot to like.

It was a small personal project, I posted about it here some months ago fwiw:

https://news.ycombinator.com/item?id=34211482

D has no (FAANG) corporate sponsor and it does all things well/has no particular speciality, these two things make it hard to compete with marketing of other languages I think

There's a small but dedicated and active community

Re: Beautiful Binary Search in D

#8
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.

   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 
https://www.ibm.com/docs/en/cobol-zos/6.1?topic=all-example-...

Re: Beautiful Binary Search in D

#10
post #4

D is the systems language I enjoy writing the most out of C++, Rust, and Go. It feels a lot like a mix between C# and JS, but at the low level access of C++. It has a lot of unique features but the "killer feature" by far for me is Contract Programming and Invariants https://tour.dlang.org/tour/en/gems/contract-programming Invariants changed my life, so much so that I built a GCC plugin to add them to C++ It used to…

Is your gcc plugin a personal project or something you built for a team ? I find the idea brilliant in itself but I wonder if other people felt the need, and uses / enjoy this kind of improvements. I want to add profile/coverage info in emacs now :) D is a strange point in PL landscape, it's been here for ages, never took off (for some value of taking off) even though it seems there's a lot to like.

D has suffered from lack of corporate sponsor, and there were a couple of reboots trying to chase the next big thing that would bring more people in, this allowed other language ecosystems to improve their shortcomings, thus reducing the distance in language features.

From my point of view in systems programming, experience with Oberon back in the day and such, I would really like that we would be talking more about D and less about Rust and Go, but unfortunately it isn't how things went.

Post reply on HN