Re: Specialization Not Allowed for Deduced Parameter

2014-08-23 Thread Ali Çehreli via Digitalmars-d-learn
On 08/22/2014 02:38 PM, Ali Çehreli wrote: Does that mean that one is the instance of the other? Will have to test that separately.) I opened the following bug about isInstanceOf!(Foo!int, Foo!int) producing 'true': https://issues.dlang.org/show_bug.cgi?id=13364 Ali

Specialization Not Allowed for Deduced Parameter

2014-08-22 Thread Yota via Digitalmars-d-learn
) { // Error: specialization not allowed for deduced parameter N auto opBinary(string op, UT : UnitDef!N, string N)(UT rhs) if (op == *) { return UnitDef!(unitString ~ ~ N)(); } } enum ft = UnitDef!ft(); enum s = UnitDef!s(); pragma(msg, typeof(ft*s)); I've tried

Re: Specialization Not Allowed for Deduced Parameter

2014-08-22 Thread Yota via Digitalmars-d-learn
On Friday, 22 August 2014 at 20:42:49 UTC, Yota wrote: Heya. I'm working on a simple units-of-measure implementation in DMD 2.066.0, and it doesn't seem to like the signature of my '*' operator below. I'm afraid I don't understand what the error description is trying to tell me. Here's a

Re: Specialization Not Allowed for Deduced Parameter

2014-08-22 Thread Ali Çehreli via Digitalmars-d-learn
On 08/22/2014 01:45 PM, Yota wrote: On Friday, 22 August 2014 at 20:42:49 UTC, Yota wrote: Heya. I'm working on a simple units-of-measure implementation in DMD 2.066.0, and it doesn't seem to like the signature of my '*' operator below. I'm afraid I don't understand what the error description

Re: Specialization Not Allowed for Deduced Parameter

2014-08-22 Thread via Digitalmars-d-learn
On Friday, 22 August 2014 at 21:22:39 UTC, Ali Çehreli wrote: On 08/22/2014 01:45 PM, Yota wrote: On Friday, 22 August 2014 at 20:42:49 UTC, Yota wrote: Heya. I'm working on a simple units-of-measure implementation in DMD 2.066.0, and it doesn't seem to like the signature of my '*' operator

Re: Specialization Not Allowed for Deduced Parameter

2014-08-22 Thread Ali Çehreli via Digitalmars-d-learn
On 08/22/2014 02:22 PM, Ali Çehreli wrote: Admittedly, std.traits.isInstanceOf is the right tool to use Answering myself: Yes, it is. but both of the following worked! I figured that out. auto opBinary(string op, That)(That rhs) if (isInstanceOf!(UnitDef, That) Note that

Re: Specialization Not Allowed for Deduced Parameter

2014-08-22 Thread Yota via Digitalmars-d-learn
On Friday, 22 August 2014 at 21:38:29 UTC, Ali Çehreli wrote: So, the correct check should use std.traits.TemplateOf first: auto opBinary(string op, That)(That rhs) if (isInstanceOf!(TemplateOf!UnitDef, That) op == *) { return UnitDef!(unitString ~ ~

Re: Specialization Not Allowed for Deduced Parameter

2014-08-22 Thread Ali Çehreli via Digitalmars-d-learn
On 08/22/2014 07:47 PM, Yota wrote: So what's up with the syntax I tried before? Has it been deprecated? I don't know the details. I am curious as well. I think it is related to value template parameters. The first example below fails but the second one works. The only difference is that