On Thursday, 18 April 2013 at 03:19:38 UTC, Walter Bright wrote:
On 4/17/2013 7:50 PM, Zach the Mystic wrote:
On Thursday, 18 April 2013 at 02:40:42 UTC, Walter Bright
wrote:
On 4/16/2013 8:22 AM, Andrei Alexandrescu wrote:
There's a discussion that may be of interest to the larger
community:
https://github.com/D-Programming-Language/dmd/pull/1877
What do you think of this:
typeof(return) foo(int x) { return x; }
? That would only infer the return type, not the attributes.
I don't actually have an opinion on whether attributes should
be inferred, but
'@auto' (as opposed to '@infer') would be a relatively
innocuous way to do it
explicitly instead of implicitly.
Except that we already support typeof(return) inside of a
function.
Yeah, I basically agree. If I had to choose right now,
typeof(return) makes more sense. It relies on the assumption that
most of the time when you want to 'auto' the return type, you
also are okay with autoing the attributes (hence typeof(return)
will be much rarer than 'auto'). It seems like a pretty safe
assumption to make. And it's weird but '@' is just uglier than
things without '@', despite that it would be nice for UDAs and
other attributes if that weren't the case.