Attribute inference for auto functions?

Walter Bright newshound2 at digitalmars.com
Wed Apr 17 16:46:03 PDT 2013


On 4/17/2013 3:20 PM, Timon Gehr wrote:
>> "This is the same issue as defining a function with 'auto' in one place
>> and referring to it having a specific type/attribute in another. So I
>> think all the same arguments and reasoning discussed above apply equally."
>>
>
> Why is this a valid form of reasoning? The signature of a function that has its
> return type inferred includes the function body.
>
> Furthermore, it is not the same issue. It is the dual issue. The distinction is
> very relevant because pure and nothrow are designed in an asymmetric way,

They are the same - adding the attribute retains covariance.

> given
> inference. Attributes can force the specification in one direction only (provide
> more guarantees to callers), but not in the other one (require less from
> subclasses).

Pure and nothrow provide more guarantees, hence covariance.

> The concerns the latter can certainly not be dismissed by using the same
> arguments and reasoning as for the former without any further examination.

They're both the same issue of covariance.



More information about the Digitalmars-d mailing list