digitalmars.D.learn - is(...) with alias this
- Zhenya (29/29) Jan 05 2013 Hi!
- Philippe Sigaud (5/5) Jan 05 2013 I think the alias this transformation is done 'before' any usual
- monarch_dodra (3/10) Jan 05 2013 Agreed. This warrants a ticket in bugzilla.
- Zhenya (2/14) Jan 06 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9274
Hi! I just read the David's post http://forum.dlang.org/thread/kc9e74$bg7$1 digitalmars.com " This code worked with dmd 2.060: import std.stdio; import std.traits; struct OhWhy(S) { S[] arr; alias arr this; } void main() { static assert(isArray!(OhWhy!(float))); } But fails with dmd 2.061: ss.d(10): Error: static assert (isArray!(OhWhy!(float))) is false (same happens with alias this to static arrays and isArray/isStaticArray) Is this intended or a regression? If latter, I'll submit a bug-ticket. " When I read this I understood that I don't know what should return is(OhWhy!float unused == T[],T) Of course OhWhy!float implicit convertable into float[].But on the other hand is with == (not :) should check the type without conversions. What do you think? DMD 2.060 HEAD evaluate is(OhWhy!float unused == T[],T) -> true
Jan 05 2013
I think the alias this transformation is done 'before' any usual conversion. I guess it's a real replacement inside the code (I'm not sure how to explain my feeling). But in any case, since OhWhy!(float) type is ... OhWhy!(float), I agree this should fail.
Jan 05 2013
On Saturday, 5 January 2013 at 22:09:45 UTC, Philippe Sigaud wrote:I think the alias this transformation is done 'before' any usual conversion. I guess it's a real replacement inside the code (I'm not sure how to explain my feeling). But in any case, since OhWhy!(float) type is ... OhWhy!(float), I agree this should fail.Agreed. This warrants a ticket in bugzilla.
Jan 05 2013
On Saturday, 5 January 2013 at 22:17:08 UTC, monarch_dodra wrote:On Saturday, 5 January 2013 at 22:09:45 UTC, Philippe Sigaud wrote:http://d.puremagic.com/issues/show_bug.cgi?id=9274I think the alias this transformation is done 'before' any usual conversion. I guess it's a real replacement inside the code (I'm not sure how to explain my feeling). But in any case, since OhWhy!(float) type is ... OhWhy!(float), I agree this should fail.Agreed. This warrants a ticket in bugzilla.
Jan 06 2013