Thread overview
Why do we have uncommented and undocumented symbols in std.traits?
May 07, 2021
Basile B.
May 07, 2021
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 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?

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:
>> 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.

Thanks.

Ah, our old friend "alias this" to be weirdly supported everywhere.

That code must be removed at once with maximum prejudice.

> 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

I 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.

Nobody agreed on the path to follow.