Re: UFCS for templates

2013-08-13 Thread Tommi
On Thursday, 8 August 2013 at 17:35:02 UTC, JS wrote: Can we have UFCS for templates? e.g., T New(T, A...)(A args) { } T t = T.New(args); Note, in this case, the type parameter is substituted. A while back I made this enhancement request: http://d.puremagic.com/issues/show_bug.cgi?id

Re: UFCS for templates

2013-08-12 Thread deadalnix
On Monday, 12 August 2013 at 12:53:40 UTC, Dicebot wrote: On Monday, 12 August 2013 at 12:07:26 UTC, eles wrote: ,,, You seem to miss the key point - burden of proof is one someone who does not spend efforts. Idea costs nothing. Proposals costs nothing. If JS would have come with done pull r

Re: UFCS for templates

2013-08-12 Thread BS
On Monday, 12 August 2013 at 12:07:26 UTC, eles wrote: On Saturday, 10 August 2013 at 18:28:34 UTC, Jonathan M Davis wrote: On Friday, August 09, 2013 05:29:05 JS wrote: On Friday, 9 August 2013 at 00:57:21 UTC, Mike Parker wrote: > On Friday, 9 August 2013 at 00:34:31 UTC, JS wrote: Um, not re

Re: UFCS for templates

2013-08-12 Thread Dicebot
On Monday, 12 August 2013 at 12:07:26 UTC, eles wrote: ,,, You seem to miss the key point - burden of proof is one someone who does not spend efforts. Idea costs nothing. Proposals costs nothing. If JS would have come with done pull request for this - it would have been my job to provide co

Re: UFCS for templates

2013-08-12 Thread eles
On Saturday, 10 August 2013 at 18:28:34 UTC, Jonathan M Davis wrote: On Friday, August 09, 2013 05:29:05 JS wrote: On Friday, 9 August 2013 at 00:57:21 UTC, Mike Parker wrote: > On Friday, 9 August 2013 at 00:34:31 UTC, JS wrote: Um, not really.. [snip] Actually, that is how it works. If you w

Re: UFCS for templates

2013-08-12 Thread eles
On Friday, 9 August 2013 at 13:36:44 UTC, monarch_dodra wrote: On Friday, 9 August 2013 at 11:46:42 UTC, eles wrote: On Friday, 9 August 2013 at 11:30:54 UTC, anonymous wrote: On Friday, 9 August 2013 at 00:34:31 UTC, JS wrote: On Thursday, 8 August 2013 at 17:55:04 UTC, Dicebot wrote: [...]

Re: UFCS for templates

2013-08-09 Thread Tyler Jameson Little
On Friday, 9 August 2013 at 07:22:12 UTC, barryharris wrote: On Friday, 9 August 2013 at 04:33:52 UTC, barryharris wrote: auto test2 = New!AnotherTest("test2", 20); oops, should read: auto test2 = New!AnotherTest(20); -1 for me anyway for the following reason: A.funct

Re: UFCS for templates

2013-08-09 Thread monarch_dodra
On Friday, 9 August 2013 at 11:46:42 UTC, eles wrote: On Friday, 9 August 2013 at 11:30:54 UTC, anonymous wrote: On Friday, 9 August 2013 at 00:34:31 UTC, JS wrote: On Thursday, 8 August 2013 at 17:55:04 UTC, Dicebot wrote: [...] As always, providing motivating use case and advantage/cost com

Re: UFCS for templates

2013-08-09 Thread Wyatt
On Friday, 9 August 2013 at 03:29:20 UTC, JS wrote: Um, not really... Do you think that god made some law that requires me to? There's nothing supernatural involved, but there is basic scientific method and engineering rigour. Anyone can throw out ideas about how they think things "ought to

Re: UFCS for templates

2013-08-09 Thread deadalnix
On Thursday, 8 August 2013 at 17:35:02 UTC, JS wrote: Can we have UFCS for templates? e.g., T New(T, A...)(A args) { } T t = T.New(args); Note, in this case, the type parameter is substituted. What happen if the first template parameter is an alias parameter ?

Re: UFCS for templates

2013-08-09 Thread deadalnix
On Friday, 9 August 2013 at 00:34:31 UTC, JS wrote: On Thursday, 8 August 2013 at 17:55:04 UTC, Dicebot wrote: On Thursday, 8 August 2013 at 17:35:02 UTC, JS wrote: Can we have UFCS for templates? e.g., T New(T, A...)(A args) { } T t = T.New(args); Note, in this case, the type parameter

Re: UFCS for templates

2013-08-09 Thread Dicebot
On Friday, 9 August 2013 at 12:22:51 UTC, Ary Borenszweig wrote: Come on, in this case I don't think he needs to provide a motivating use case. What's the motivating use case for UFCS in the first place? You can live without it just fine, only the syntax is uglier. Being able to call a functi

Re: UFCS for templates

2013-08-09 Thread Ary Borenszweig
On 8/8/13 2:55 PM, Dicebot wrote: On Thursday, 8 August 2013 at 17:35:02 UTC, JS wrote: Can we have UFCS for templates? e.g., T New(T, A...)(A args) { } T t = T.New(args); Note, in this case, the type parameter is substituted. As always, providing motivating use case and advantage/cost

Re: UFCS for templates

2013-08-09 Thread Dicebot
On Friday, 9 August 2013 at 11:46:42 UTC, eles wrote: C'mon, guys, cool down. Both (or the three) of you are right. Some tend to forget that everybody here is a volunteer, so there is no such such thing as a duty. Others are enthusiastic and throw in ideas. People are of different kinds, sparks

Re: UFCS for templates

2013-08-09 Thread eles
On Friday, 9 August 2013 at 11:30:54 UTC, anonymous wrote: On Friday, 9 August 2013 at 00:34:31 UTC, JS wrote: On Thursday, 8 August 2013 at 17:55:04 UTC, Dicebot wrote: [...] As always, providing motivating use case and advantage/cost comparison is usual requirement to make something happen.

Re: UFCS for templates

2013-08-09 Thread anonymous
On Friday, 9 August 2013 at 00:34:31 UTC, JS wrote: On Thursday, 8 August 2013 at 17:55:04 UTC, Dicebot wrote: [...] As always, providing motivating use case and advantage/cost comparison is usual requirement to make something happen. DIP's exist for a reason. Are you not smart enough to co

Re: UFCS for templates

2013-08-09 Thread Mike Parker
On Friday, 9 August 2013 at 03:29:20 UTC, JS wrote: It's not his proposal. The burden of proof is on you. I would think that if you really cared about the D lang you would want it to be the best it can... In any case, I know very well that it is quite useless for me to make suggestions fo

Re: UFCS for templates

2013-08-09 Thread barryharris
On Friday, 9 August 2013 at 04:33:52 UTC, barryharris wrote: auto test2 = New!AnotherTest("test2", 20); oops, should read: auto test2 = New!AnotherTest(20); -1 for me anyway for the following reason: A.function(args)// I know A is a function value parameter functi

Re: UFCS for templates

2013-08-08 Thread barryharris
auto test2 = New!AnotherTest("test2", 20); oops, should read: auto test2 = New!AnotherTest(20); -1 for me anyway for the following reason: A.function(args)// I know A is a function value parameter function!A(args)// I know A is a template type parameter functi

Re: UFCS for templates

2013-08-08 Thread barryharris
On Thursday, 8 August 2013 at 17:35:02 UTC, JS wrote: Can we have UFCS for templates? e.g., T New(T, A...)(A args) { } T t = T.New(args); Note, in this case, the type parameter is substituted. Actually, what is wrong with New!T(args)? This works fine for me: T t = New!T(args

Re: UFCS for templates

2013-08-08 Thread barryharris
On Friday, 9 August 2013 at 03:41:56 UTC, barryharris wrote: So instead of: T t = New!T(args) you would like: T t = T.New(args) Is that it? Never mind, I read your original post again... Note, in this case, the type parameter is substituted.

Re: UFCS for templates

2013-08-08 Thread Jonathan M Davis
On Friday, August 09, 2013 05:29:05 JS wrote: > On Friday, 9 August 2013 at 00:57:21 UTC, Mike Parker wrote: > > On Friday, 9 August 2013 at 00:34:31 UTC, JS wrote: > >> Are you not smart enough to come up with use cases yourself? > >> This is not some extremely rare thing that might be used 1 in >

Re: UFCS for templates

2013-08-08 Thread barryharris
So instead of: T t = New!T(args) you would like: T t = T.New(args) Is that it?

Re: UFCS for templates

2013-08-08 Thread JS
On Friday, 9 August 2013 at 00:57:21 UTC, Mike Parker wrote: On Friday, 9 August 2013 at 00:34:31 UTC, JS wrote: Are you not smart enough to come up with use cases yourself? This is not some extremely rare thing that might be used 1 in 10^100. It's not his proposal. The burden of proof is on

Re: UFCS for templates

2013-08-08 Thread Mike Parker
On Friday, 9 August 2013 at 00:34:31 UTC, JS wrote: Are you not smart enough to come up with use cases yourself? This is not some extremely rare thing that might be used 1 in 10^100. It's not his proposal. The burden of proof is on you.

Re: UFCS for templates

2013-08-08 Thread JS
On Thursday, 8 August 2013 at 17:55:04 UTC, Dicebot wrote: On Thursday, 8 August 2013 at 17:35:02 UTC, JS wrote: Can we have UFCS for templates? e.g., T New(T, A...)(A args) { } T t = T.New(args); Note, in this case, the type parameter is substituted. As always, providing motivating use

Re: UFCS for templates

2013-08-08 Thread Jonathan M Davis
On Thursday, August 08, 2013 19:35:01 JS wrote: > Can we have UFCS for templates? > > e.g., > > T New(T, A...)(A args) { } > > > T t = T.New(args); > > > Note, in this case, the type parameter is substituted. And how is the compiler supposed to know whether

Re: UFCS for templates

2013-08-08 Thread Dicebot
On Thursday, 8 August 2013 at 17:35:02 UTC, JS wrote: Can we have UFCS for templates? e.g., T New(T, A...)(A args) { } T t = T.New(args); Note, in this case, the type parameter is substituted. As always, providing motivating use case and advantage/cost comparison is usual requirement to

Re: UFCS for templates

2013-08-08 Thread Tofu Ninja
On Thursday, 8 August 2013 at 17:35:02 UTC, JS wrote: Can we have UFCS for templates? e.g., T New(T, A...)(A args) { } T t = T.New(args); Note, in this case, the type parameter is substituted. That would be nice things to have, it would allow the parse!type(...) to be turned into

UFCS for templates

2013-08-08 Thread JS
Can we have UFCS for templates? e.g., T New(T, A...)(A args) { } T t = T.New(args); Note, in this case, the type parameter is substituted.