Auto returntype

sarn sarn at theartofmachinery.com
Mon May 20 00:31:48 UTC 2019


On Sunday, 19 May 2019 at 23:10:08 UTC, Para wrote:
> Unless I have very poor reading comprehension, which I might, I 
> believe this is already a feature: 
> https://dlang.org/spec/function.html#auto-functions

The type of an auto function is inferred from the return 
argument, but I think Alex wants more sophisticated inference 
based on usage.  Maybe something like Hindley-Milner, as used in 
Haskell: 
http://www.codecommit.com/blog/scala/what-is-hindley-milner-and-why-is-it-cool

D's templates could theoretically support more inference, but 
that would need
1) Someone interested enough to implement it
2) Someone who can convince Walter that it won't make D's 
template system too complicated


More information about the Digitalmars-d mailing list