digitalmars.D - safe pure nothrow compiler inference
- Atila Neves (5/5) Sep 29 2014 So somehow I missed that for template functions the attributes
- Daniel N (6/11) Sep 29 2014 It can be done, Walter wanted to do it, but there was large
- Walter Bright (5/16) Oct 01 2014 I wanted to do it for "auto" returning functions, since they require a
- Atila Neves (2/4) Oct 01 2014 Is there any good reason to _not_ do it for auto return functions?
- Kagamin (5/8) Oct 01 2014 Huh? Templates are part of library API too, see std.algorithm. So
- monarch_dodra (5/13) Oct 01 2014 It's not that "it's OK for templates", it's that you *must* have
- Steven Schveighoffer (9/13) Sep 29 2014 There was a push to do it for ctors, and require them to be available. I...
So somehow I missed that for template functions the attributes can be inferred. From what I can tell it has to do with having the body available. But when not using .di files, why can't it be done for regular functions? Atila
Sep 29 2014
On Monday, 29 September 2014 at 14:32:16 UTC, Atila Neves wrote:So somehow I missed that for template functions the attributes can be inferred. From what I can tell it has to do with having the body available. But when not using .di files, why can't it be done for regular functions? AtilaIt can be done, Walter wanted to do it, but there was large resistance, mainly because library APIs would become unstable, possibly changing between every release. IMHO it would be safe to use inference for private functions... Daniel N
Sep 29 2014
On 9/29/2014 7:40 AM, Daniel N wrote:On Monday, 29 September 2014 at 14:32:16 UTC, Atila Neves wrote:I wanted to do it for "auto" returning functions, since they require a function body.So somehow I missed that for template functions the attributes can be inferred. From what I can tell it has to do with having the body available. But when not using .di files, why can't it be done for regular functions? AtilaIt can be done, Walter wanted to do it, but there was large resistance, mainly because library APIs would become unstable, possibly changing between every release.IMHO it would be safe to use inference for private functions...Not a bad idea. Please file as an enhancement request. The more attribute inference we can do, the better.
Oct 01 2014
I wanted to do it for "auto" returning functions, since they require a function body.Is there any good reason to _not_ do it for auto return functions? Atila
Oct 01 2014
On Monday, 29 September 2014 at 14:40:34 UTC, Daniel N wrote:It can be done, Walter wanted to do it, but there was large resistance, mainly because library APIs would become unstable, possibly changing between every release.Huh? Templates are part of library API too, see std.algorithm. So what's the difference if the API consists of templated or non-templated functions? Why for one part of API it's ok to change with every release and for the other not ok?
Oct 01 2014
On Wednesday, 1 October 2014 at 15:12:41 UTC, Kagamin wrote:On Monday, 29 September 2014 at 14:40:34 UTC, Daniel N wrote:It's not that "it's OK for templates", it's that you *must* have inference. This was not an argument against having inference for normal functions.It can be done, Walter wanted to do it, but there was large resistance, mainly because library APIs would become unstable, possibly changing between every release.Huh? Templates are part of library API too, see std.algorithm. So what's the difference if the API consists of templated or non-templated functions? Why for one part of API it's ok to change with every release and for the other not ok?
Oct 01 2014
On 9/29/14 10:32 AM, Atila Neves wrote:So somehow I missed that for template functions the attributes can be inferred. From what I can tell it has to do with having the body available. But when not using .di files, why can't it be done for regular functions?There was a push to do it for ctors, and require them to be available. I think this was actually discussed by Walter at one conference talk (maybe you missed it). I think we should have an infer property that would infer the properties and require the function body in .di (compiler would output it for .di generation also). For various reasons, this all fell through. -Steve
Sep 29 2014