Attribute inference for auto functions?

Michel Fortin michel.fortin at michelf.ca
Wed Apr 17 20:55:47 PDT 2013


On 2013-04-17 19:05:01 +0000, Walter Bright <newshound2 at digitalmars.com> said:

> On 4/17/2013 10:37 AM, Michel Fortin wrote:
>> Compilation speed is not a problem for functions with the "auto" return type
>> because there are only a few of them.
> 
> It is not a problem right now because the compiler has to semantically 
> analyze their function bodies already in order to determine the return 
> type. It is insignificant to additionally gather the attribute 
> information.

True, but beside the point.

My point was that if auto allows attribute inference people will be 
tempted to (and will do) change their return types to auto in their 
programs just to get that benefit (no one wants to annotate all their 
functions).

Thus, as more and more functions become "auto" compile times will 
become slower.

Pushed to the extreme, you'd get the same result as if you were 
inferring attributes for all functions, plus more confusion because all 
the return types are obfuscated.

-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca/



More information about the Digitalmars-d mailing list