digitalmars.D.bugs - [Issue 9835] New: DynamicArrayTypeOf and isDynamicArray work inconsistently
- d-bugmail puremagic.com (31/31) Mar 30 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9835
- d-bugmail puremagic.com (23/23) Mar 30 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9835
- d-bugmail puremagic.com (11/11) Mar 30 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9835
http://d.puremagic.com/issues/show_bug.cgi?id=9835 Summary: DynamicArrayTypeOf and isDynamicArray work inconsistently Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: tobias pankrath.net PDT --- --- struct Wrapper { int[] data; alias data this; }; pragma(msg, DynamicArrayTypeOf!Wrapper) // int[] pragma(msg, isDynamicArray!Wrapper) // false --- There are two issues here: The first one is that DynamicArrayTypeOf and isDynamicArray should work consistently that is, isDynamicArray!T should be true if and only if DynamicArrayTypeOf!T yields a type. Second according to TDPL alias this makes Wrapper a subtype of int[] and isDynamicArray!Wrapper should be true or otherwise isDynamicArray is quite useless as a template constraint like in std.array.popFront. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 30 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9835 Current behavior is completely intended, so it's not a bug. In old days, I thought that std.traits.isSomething should consider alias this types. That was necessary for std.format and std.conv implementation. For the purpose I added std.traits.SomethingTypeOf, and used them as the implementation of isSomething. https://github.com/D-Programming-Language/phobos/pull/488 But, the change of isSomething's behavior had been complained as a bug by some peoples. They said "isDymanicArray!T should be true if and only if T is actually a dynamic array type. If T is a struct with alias this, it should return false". I finally agreed with that and reverted the behavior. https://github.com/D-Programming-Language/phobos/pull/976 Now, std.format and std.conv uses is(SomethingTypeOf!T). Furthermore, SomethingTypeOf is now *undocumented* templates, so their specifications are "as-is". (But considering "alias this" type is sometimes useful, so they are not marked wit "package".) If you really need SomethingTypeOf, please open an enhancement that they should be *documented*. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 30 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9835 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID I think that both isSomething and SomethingTypeOf should not be changed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 30 2013