Re: Function template argument deduction

2018-04-07 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 7 April 2018 at 14:02:55 UTC, Paul Backus wrote: Interesting. Looks like this is an issue with aliases, because I get the error with this code too: --- test.d import std.typecons: Tuple, tuple; alias Pair(T) = Tuple!(T, T); void foo(T)(Pair!T p) { return; } unittest { Pa

Re: Function template argument deduction

2018-04-07 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 7 April 2018 at 06:26:24 UTC, Uknown wrote: What I did notice though is that when `string list2string(T)(List!T list)` was changed to `string list2string(T)(VariantN!(16LU, Nil, Tuple!(T, "head", This*, "tail")) list)` The compiler correctly deduce `T` to be `int` Interesting. Lo

Re: Function template argument deduction

2018-04-06 Thread Ali Çehreli via Digitalmars-d-learn
On 04/06/2018 11:26 PM, Uknown wrote: > On Saturday, 7 April 2018 at 05:58:10 UTC, Paul Backus wrote: >> On Saturday, 7 April 2018 at 05:46:07 UTC, Uknown wrote: >>> I don't see the error you are talking about: >>> https://run.dlang.io/is/XWPIc1 >>> >>> Are you using the latest compiler? >> >> Com

Re: Function template argument deduction

2018-04-06 Thread Uknown via Digitalmars-d-learn
On Saturday, 7 April 2018 at 05:58:10 UTC, Paul Backus wrote: On Saturday, 7 April 2018 at 05:46:07 UTC, Uknown wrote: I don't see the error you are talking about: https://run.dlang.io/is/XWPIc1 Are you using the latest compiler? Compile with -unittest. And yes; I'm using DMD 2.079.0. Now

Re: Function template argument deduction

2018-04-06 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 7 April 2018 at 05:46:07 UTC, Uknown wrote: I don't see the error you are talking about: https://run.dlang.io/is/XWPIc1 Are you using the latest compiler? Compile with -unittest. And yes; I'm using DMD 2.079.0.

Re: Function template argument deduction

2018-04-06 Thread Uknown via Digitalmars-d-learn
On Saturday, 7 April 2018 at 05:10:05 UTC, Paul Backus wrote: I'm playing around with functional programming in D, and have run into a problem with the following code: [...] I don't see the error you are talking about: https://run.dlang.io/is/XWPIc1 Are you using the latest compiler?

Function template argument deduction

2018-04-06 Thread Paul Backus via Digitalmars-d-learn
I'm playing around with functional programming in D, and have run into a problem with the following code: --- list.d import std.variant: Algebraic, This, visit; import std.typecons: Tuple, tuple; struct Nil {} alias List(T) = Algebraic!( Nil, Tuple!(T, "head", This*, "tail") ); alias Co