Attribute inference for auto functions?

kenji hara k.hara.pg at gmail.com
Wed Apr 17 22:59:04 PDT 2013


2013/4/18 Walter Bright <newshound2 at digitalmars.com>

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

It will break existing code.

int foo() {
    typeof(return) bar() { return 1; }
    return bar();
}

typeof(return) represents the return type of foo, that is int.

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130418/a7c7b5d7/attachment.html>


More information about the Digitalmars-d mailing list