Would it be possible (and useful) to introduce declarations like `auto foo() if(isInputRange(auto));`

2012-05-17 Thread Roman D. Boiko
Is there anything preventing us from adding constraints on the auto function return value? I mean, such language extension seems to be quite useful. For example, it would be no longer necessary to provide method bodies for functions with auto return values. In many cases this would

Re: Would it be possible (and useful) to introduce declarations like `auto foo() if(isInputRange(auto));`

2012-05-17 Thread Roman D. Boiko
On Thursday, 17 May 2012 at 11:49:18 UTC, Roman D. Boiko wrote: Is there anything preventing us from adding constraints on the auto function return value? I mean, such language extension seems to be quite useful. For example, it would be no longer necessary to provide method bodies for

Re: Would it be possible (and useful) to introduce declarations like `auto foo() if(isInputRange(auto));

2012-05-17 Thread Jonathan M Davis
` To: digitalmars.D digitalmars-d@puremagic.com User-Agent: KMail/4.8.2 (Linux/3.3.1-1-ARCH; KDE/4.8.2; x86_64; ; ) X-Authenticated: #68274723 X-Flags: 0001 X-KMail-CryptoMessageFormat: 15 X-KMail-EncryptActionEnabled: false X-KMail-Fcc: 15 X-KMail-SignatureActionEnabled: false X-KMail-Transport:

Re: Would it be possible (and useful) to introduce declarations like `auto foo() if(isInputRange(auto));

2012-05-17 Thread Roman D. Boiko
On Thursday, 17 May 2012 at 21:09:10 UTC, Jonathan M Davis wrote: It would still be necessary, because the compiler needs to know what the actual return type is. Knowing that the type implements popFront, front, and empty isn't enough. It needs to know the actual, physical layout of the type

Re: Would it be possible (and useful) to introduce declarations like `auto foo() if(isInputRange(auto)); `

2012-05-17 Thread Jonathan M Davis
On Thursday, May 17, 2012 13:49:16 Roman D. Boiko wrote: Is there anything preventing us from adding constraints on the auto function return value? I mean, such language extension seems to be quite useful. For example, it would be no longer necessary to provide method bodies for functions