Attribute inference for auto functions?

deadalnix deadalnix at gmail.com
Wed Apr 17 18:28:51 PDT 2013


On Wednesday, 17 April 2013 at 19:53:07 UTC, Walter Bright wrote:
> On 4/17/2013 12:58 AM, deadalnix wrote:
>> Back to the subject, if auto bind to the function it must 
>> infers attributes, if
>> it binds to the return type, it mustn't. And right now, 
>> storage class bind to
>> the function.
>
> 'auto', like all storage class annotations such as 'const', 
> binds to the declaration and the declaration's type. It is 
> perfectly consistent.
>
>
> > extern(C) void function() foo; // does extern binds to foo,
> foo's type or both ?
>
> foo is being declared, so it binds to foo.
>
> > pure function() function() bar; // is bar a pure function ?
> is bar() pure ? Noth ? How to choose ?
>
> bar is being declared, so it binds to bar.

Yes I know. That was my point : auto bind to the function 
according to current spec, so function type should be inferred, 
which imply both return type and attributes.

Points raised in the thread show that people need in general to 
be able to annotate specifically the return type or whatever, and 
this is rather difficult with the current state of thing (and 
also it seems quite hard to fix).


More information about the Digitalmars-d mailing list