We're #1 on Hacker News at the moment!
Ethan
gooberman at gmail.com
Tue Apr 28 18:25:28 UTC 2020
On Tuesday, 28 April 2020 at 17:06:03 UTC, Adam D. Ruppe wrote:
> Type inference itself isn't bad, but the auto in documentation
> is something I agree isn't great.
My hot take after years of explicit typing (remember manual for
iterator loops in C++?) and more D metaprogramming than most is
that "auto is perfect for things you don't intend the user to
store".
Since that's all that anti-auto arguments come down to here - the
only rational reason you need to know the return type of a
function is that you intend on storing it somewhere. And that's
kinda pointless with ranges returned by std.algorithm for example.
Perhaps there's actually a design win to be had here if we can
define nostore or something like that as a return qualifier...
More information about the Digitalmars-d
mailing list