Thread overview | |||||
---|---|---|---|---|---|
|
March 30, 2013 [Issue 9835] New: DynamicArrayTypeOf and isDynamicArray work inconsistently | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from Tobias Pankrath <tobias@pankrath.net> 2013-03-30 06:48:11 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: ------- |
March 30, 2013 [Issue 9835] DynamicArrayTypeOf and isDynamicArray work inconsistently | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tobias Pankrath | http://d.puremagic.com/issues/show_bug.cgi?id=9835 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-03-30 07:12:21 PDT --- 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: ------- |
March 30, 2013 [Issue 9835] DynamicArrayTypeOf and isDynamicArray work inconsistently | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tobias Pankrath | 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 --- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-03-30 07:13:59 PDT --- 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: ------- |
Copyright © 1999-2021 by the D Language Foundation