News for hackers. Stuff that matters.
Re:Better C – A subset of D Programming Language by asdkjh345fd on Tuesday April 28, 2020 @07:54PM (#23013594)
Yes, the type is very interesting to know. That's why other languages make it known. Ignoring the entire discussion to reply twice with "nu uh!" is not very productive.
Re:Better C – A subset of D Programming Language by aldacron on Tuesday April 28, 2020 @10:46PM (#23014735)
There's usually no reason to know the return type of any range-based function in D. It's not like auto is applied as a return type willy nilly. And anyone who understands D's ranges and how they are used should have no problem seeing a function declaration that returns auto.
Re:Better C – A subset of D Programming Language by asdkjh345fd on Wednesday April 29, 2020 @08:04AM (#23018121)
Right, the entire world is wrong because you can't admit a fault in a random piece of software you are emotionally invested in. Makes sense.
Re:Better C – A subset of D Programming Language by aldacron on Wednesday April 29, 2020 @10:37AM (#23019764)
Not quite. I'm saying that in this case it doesn't matter because of the way the API is used. Is it confusing for people who don't understand D ranges? Yes, it certainly can be. It was for me when ranges first came along. But once you understand how D ranges are intended to be used, then you realize you rarely ever care what the return type is. D is not Rust, or C++, or (insert language here).

When the return type actually matters, auto should be avoided unless there's no way around it. But that's why we have "Returns:" in Ddoc. The function signature itself is not the complete documentation. I mean, you're acting like all D functions are documented to return auto. They aren't. It's used where it needs to be.