Re: Non-consistent implicit function template specializations

2021-08-18 Thread Ali Çehreli via Digitalmars-d-learn
On 8/18/21 4:10 AM, Rekel wrote: >> isArray!T && (isArray!(ElementType!T)) > > I tried looking into how isArray is defined. Like, does being able to > index mean it's an array, or are these only static &/or dynamic arrays? The definitions are in phobos/std/traits.d enum bool isArray(T) =

Re: Non-consistent implicit function template specializations

2021-08-18 Thread Rekel via Digitalmars-d-learn
On Wednesday, 18 August 2021 at 13:35:07 UTC, Paul Backus wrote: On Wednesday, 18 August 2021 at 11:10:49 UTC, Rekel wrote: I tried looking into how isArray is defined. Like, does being able to index mean it's an array, or are these only static &/or dynamic arrays? Did you read the

Re: Non-consistent implicit function template specializations

2021-08-18 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 18 August 2021 at 11:10:49 UTC, Rekel wrote: I tried looking into how isArray is defined. Like, does being able to index mean it's an array, or are these only static &/or dynamic arrays? Did you read the documentation? https://phobos.dpldocs.info/std.traits.isArray.html

Re: Non-consistent implicit function template specializations

2021-08-18 Thread Rekel via Digitalmars-d-learn
On Tuesday, 17 August 2021 at 18:46:05 UTC, Ali Çehreli wrote: I don't have such problems because I am not smart enough to understand that syntax so I don't use it. :) I use template constraints (which have other problems). Yeah, they seem to be a bit more trustworthy to some extent. If you

Re: Non-consistent implicit function template specializations

2021-08-18 Thread Rekel via Digitalmars-d-learn
On Tuesday, 17 August 2021 at 18:27:21 UTC, Steven Schveighoffer wrote: According to my tests, it prefers the `T` version over the static array version. Which leads me to believe that it prefers a dynamic array over a static one. In fact, if I comment out the `T` version, it doesn't compile.

Re: Non-consistent implicit function template specializations

2021-08-17 Thread Ali Çehreli via Digitalmars-d-learn
On 8/17/21 2:59 AM, Rekel wrote: > template TFoo(T){ void foo(){writeln("1");} } // #1 > template TFoo(T : T[]) { void foo(){writeln("2");} } // #2 I don't have such problems because I am not smart enough to understand that syntax so I don't use it. :) I use template constraints

Re: Non-consistent implicit function template specializations

2021-08-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/17/21 2:07 PM, Rekel wrote: On Tuesday, 17 August 2021 at 16:24:38 UTC, Steven Schveighoffer wrote: All these are calling with array literals, which default to dynamic arrays, not static arrays. I realise that is their default, though in this scenario they should (I believe) be used

Re: Non-consistent implicit function template specializations

2021-08-17 Thread Rekel via Digitalmars-d-learn
On Tuesday, 17 August 2021 at 16:24:38 UTC, Steven Schveighoffer wrote: void foo(T:U[L], uint L)(T a){...} This is an invalid specification, what is U? Did you mean: Yes, sorry typo in the forum. void foo(T: U[L], U, uint L)(T a) {...} void foo(T:U[L][L], uint L)(T a){...} // Never

Re: Non-consistent implicit function template specializations

2021-08-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/17/21 10:20 AM, Rekel wrote: As my post was not the actual cause of my issue (my apology for the mistake), I think I have found the actual reason I'm currently having problems. This seems to be related to a (seeming, I might be wrong) inability to specialize over both 1d and 2d arrays

Re: Non-consistent implicit function template specializations

2021-08-17 Thread Rekel via Digitalmars-d-learn
As my post was not the actual cause of my issue (my apology for the mistake), I think I have found the actual reason I'm currently having problems. This seems to be related to a (seeming, I might be wrong) inability to specialize over both 1d and 2d arrays separately. (If constraining the

Re: Non-consistent implicit function template specializations

2021-08-17 Thread Rekel via Digitalmars-d-learn
On Tuesday, 17 August 2021 at 10:21:39 UTC, Mike Parker wrote: We do have a paid Issue/Pull-Request manager now (Razvan Nitu), and he's prioritizing issues for strike teams composed of volunteers willing to fix them. If you find a specific bug that is a blocker or a major headache, make a post

Re: Non-consistent implicit function template specializations

2021-08-17 Thread Rekel via Digitalmars-d-learn
On Tuesday, 17 August 2021 at 10:14:07 UTC, Mike Parker wrote: The error is in your code. Both of your `foo` templates are implemented to print `"1"`. Change the second one to print "2" and you will see the desired output. I keep managing to disappoint myself greatly... this is absurd, so

Re: Non-consistent implicit function template specializations

2021-08-17 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 17 August 2021 at 09:59:53 UTC, Rekel wrote: time in the future. Even bugs don't seem to get fixed in any timely manner (Not meant as an insult, just being realistic :/). We do have a paid Issue/Pull-Request manager now (Razvan Nitu), and he's prioritizing issues for strike teams

Re: Non-consistent implicit function template specializations

2021-08-17 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 17 August 2021 at 09:59:53 UTC, Rekel wrote: When using implicit function templates, identical specialization yield different results. Example: ```d template TFoo(T){ void foo(){writeln("1");} } // #1 template TFoo(T : T[]) { void foo(){writeln("2");} } // #2 void

Non-consistent implicit function template specializations

2021-08-17 Thread Rekel via Digitalmars-d-learn
When using implicit function templates, identical specialization yield different results. Example: ```d template TFoo(T){ void foo(){writeln("1");} } // #1 template TFoo(T : T[]) { void foo(){writeln("2");} } // #2 void foo(T)(){ writeln("1"); } void foo(T : T[])(){