Re: Annoying thing about auto ref function template

2017-03-22 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, March 21, 2017 09:27:55 Yuxuan Shui via Digitalmars-d wrote: > On Tuesday, 21 March 2017 at 01:10:38 UTC, Jonathan M Davis wrote: > > On Monday, March 20, 2017 22:14:37 Yuxuan Shui via > > > > Digitalmars-d wrote: > >> On Monday, 20 March 2017 at 21:53:47 UTC, Jonathan M Davis > >> >

Re: Annoying thing about auto ref function template

2017-03-21 Thread Yuxuan Shui via Digitalmars-d
On Tuesday, 21 March 2017 at 01:10:38 UTC, Jonathan M Davis wrote: On Monday, March 20, 2017 22:14:37 Yuxuan Shui via Digitalmars-d wrote: On Monday, 20 March 2017 at 21:53:47 UTC, Jonathan M Davis wrote: > [...] Makes sense... OK, attempt 2: how about support implicit partial application

Re: Annoying thing about auto ref function template

2017-03-20 Thread Jonathan M Davis via Digitalmars-d
On Monday, March 20, 2017 22:14:37 Yuxuan Shui via Digitalmars-d wrote: > On Monday, 20 March 2017 at 21:53:47 UTC, Jonathan M Davis wrote: > > On Monday, March 20, 2017 21:37:26 Yuxuan Shui via > > > > Digitalmars-d wrote: > >> [...] > > > > auto ref for non-templates would not be quite the same

Re: Annoying thing about auto ref function template

2017-03-20 Thread Yuxuan Shui via Digitalmars-d
On Monday, 20 March 2017 at 21:53:47 UTC, Jonathan M Davis wrote: On Monday, March 20, 2017 21:37:26 Yuxuan Shui via Digitalmars-d wrote: [...] auto ref for non-templates would not be quite the same thing, and regardless, it wouldn't help any with explictly instantiating a template that had

Re: Annoying thing about auto ref function template

2017-03-20 Thread Jonathan M Davis via Digitalmars-d
On Monday, March 20, 2017 21:37:26 Yuxuan Shui via Digitalmars-d wrote: > On Monday, 20 March 2017 at 21:34:14 UTC, Yuxuan Shui wrote: > > On Monday, 20 March 2017 at 21:08:40 UTC, Jonathan M Davis > > > > wrote: > >> [...] > > > > This is a bit tedious because it requires you creating a new > >

Re: Annoying thing about auto ref function template

2017-03-20 Thread Yuxuan Shui via Digitalmars-d
On Monday, 20 March 2017 at 21:34:14 UTC, Yuxuan Shui wrote: On Monday, 20 March 2017 at 21:08:40 UTC, Jonathan M Davis wrote: [...] This is a bit tedious because it requires you creating a new function. Maybe we can create a template for that. But still, auto ref requires us to do things

Re: Annoying thing about auto ref function template

2017-03-20 Thread Yuxuan Shui via Digitalmars-d
On Monday, 20 March 2017 at 21:08:40 UTC, Jonathan M Davis wrote: On Monday, March 20, 2017 13:20:52 Jonathan M Davis via Digitalmars-d wrote: So, yes, this particular restriction can be annoying, but there is a good reason for the restriction (though the error message _is_ pretty bad), and I

Re: Annoying thing about auto ref function template

2017-03-20 Thread Jonathan M Davis via Digitalmars-d
On Monday, March 20, 2017 13:20:52 Jonathan M Davis via Digitalmars-d wrote: > So, yes, this particular restriction can be annoying, but there is a good > reason for the restriction (though the error message _is_ pretty bad), and > I have no idea how we would fix the problem. After thinking about

Re: Annoying thing about auto ref function template

2017-03-20 Thread Jonathan M Davis via Digitalmars-d
On Monday, March 20, 2017 19:49:03 Yuxuan Shui via Digitalmars-d wrote: > An auto ref function template should behave like a normal > function template, but it doesn't. > > You can fully instantiate a function template by specifying all > of its template parameters, but you can't do that with auto

Re: Annoying thing about auto ref function template

2017-03-20 Thread Yuxuan Shui via Digitalmars-d
On Monday, 20 March 2017 at 19:49:03 UTC, Yuxuan Shui wrote: And you can't do that with an auto ref template, which makes them quite annoying. BTW, the error message you get when you try to do this, is not very helpful: 'auto' can only be used as part of 'auto ref' for template function

Annoying thing about auto ref function template

2017-03-20 Thread Yuxuan Shui via Digitalmars-d
An auto ref function template should behave like a normal function template, but it doesn't. You can fully instantiate a function template by specifying all of its template parameters, but you can't do that with auto ref templates. The only way to instantiate an auto ref template is to call