digitalmars.D - Why do we have uncommented and undocumented symbols in std.traits?
- Andrei Alexandrescu (18/18) May 07 2021 BooleanTypeOf
- Petar Kirov [ZombineDev] (14/32) May 07 2021 As far as I can tell from the [PR][0] that added them, they were
- Andrei Alexandrescu (5/42) May 07 2021 Thanks.
- Basile B. (2/26) May 07 2021 Nobody agreed on the path to follow.
BooleanTypeOf IntegralTypeOf FloatingPointTypeOf NumericTypeOf UnsignedTypeOf SignedTypeOf CharTypeOf StaticArrayTypeOf DynamicArrayTypeOf ArrayTypeOf AssocArrayTypeOf BuiltinTypeOf Looking at their subtly repetitive definitions, they are specious to start with, but they have absolutely no comments so who knows what they're useful for. People ask "what would do phobos better?" and it's ironic because literally whatever file I open there are dozens of immediate and urgent improvements to be done that scream at you.
May 07 2021
On Friday, 7 May 2021 at 16:31:35 UTC, Andrei Alexandrescu wrote:BooleanTypeOf IntegralTypeOf FloatingPointTypeOf NumericTypeOf UnsignedTypeOf SignedTypeOf CharTypeOf StaticArrayTypeOf DynamicArrayTypeOf ArrayTypeOf AssocArrayTypeOf BuiltinTypeOf Looking at their subtly repetitive definitions, they are specious to start with, but they have absolutely no comments so who knows what they're useful for. People ask "what would do phobos better?" and it's ironic because literally whatever file I open there are dozens of immediate and urgent improvements to be done that scream at you.As far as I can tell from the [PR][0] that added them, they were needed so that `std.format` can treat `struct S(T) { T x; alias x this; }` as `T` if `T` is a built-in type, by having `AbcTypeOf!(S(T))` yield `T`, if `T` is `Abc` (e.g. Boolean, FloatingPoint, etc.) in template constraints. In other words, it looks like they were meant only for Phobos-internal use. These days, we use `package (std)` for such symbols. Perhaps that `package` protection attributes were not implemented (or not working reliably) in ~2012? There is no discussion in that pull request, so perhaps you had discussed the matter with Kenji either on the newsgroup, Bugzilla, in other pull request, or privately? [0]: https://github.com/dlang/phobos/pull/488
May 07 2021
On 5/7/21 4:50 PM, Petar Kirov [ZombineDev] wrote:On Friday, 7 May 2021 at 16:31:35 UTC, Andrei Alexandrescu wrote:Thanks. Ah, our old friend "alias this" to be weirdly supported everywhere. That code must be removed at once with maximum prejudice.BooleanTypeOf IntegralTypeOf FloatingPointTypeOf NumericTypeOf UnsignedTypeOf SignedTypeOf CharTypeOf StaticArrayTypeOf DynamicArrayTypeOf ArrayTypeOf AssocArrayTypeOf BuiltinTypeOf Looking at their subtly repetitive definitions, they are specious to start with, but they have absolutely no comments so who knows what they're useful for. People ask "what would do phobos better?" and it's ironic because literally whatever file I open there are dozens of immediate and urgent improvements to be done that scream at you.As far as I can tell from the [PR][0] that added them, they were needed so that `std.format` can treat `struct S(T) { T x; alias x this; }` as `T` if `T` is a built-in type, by having `AbcTypeOf!(S(T))` yield `T`, if `T` is `Abc` (e.g. Boolean, FloatingPoint, etc.) in template constraints.In other words, it looks like they were meant only for Phobos-internal use. These days, we use `package (std)` for such symbols. Perhaps that `package` protection attributes were not implemented (or not working reliably) in ~2012? There is no discussion in that pull request, so perhaps you had discussed the matter with Kenji either on the newsgroup, Bugzilla, in other pull request, or privately? [0]: https://github.com/dlang/phobos/pull/488I made a terrible mistake accepting that PR.
May 07 2021
On Friday, 7 May 2021 at 16:31:35 UTC, Andrei Alexandrescu wrote:BooleanTypeOf IntegralTypeOf FloatingPointTypeOf NumericTypeOf UnsignedTypeOf SignedTypeOf CharTypeOf StaticArrayTypeOf DynamicArrayTypeOf ArrayTypeOf AssocArrayTypeOf BuiltinTypeOf Looking at their subtly repetitive definitions, they are specious to start with, but they have absolutely no comments so who knows what they're useful for. People ask "what would do phobos better?" and it's ironic because literally whatever file I open there are dozens of immediate and urgent improvements to be done that scream at you.[The entire SomethingTypeOf idiom has smell. It is pedestrian, repetitive, and arcane - everything NOT characteristic to good D code. I am sorry I have allowed these symbols in the first place, doubly so for not figuring out they added undocumented public symbols, triply so that so much time has passed since.](https://github.com/dlang/phobos/pull/5747#issuecomment-333421636)Nobody agreed on the path to follow.
May 07 2021