| Thread overview | |||||||
|---|---|---|---|---|---|---|---|
|
October 21, 2015 MutableOf etc and QualifierOf | ||||
|---|---|---|---|---|
| ||||
The templates `MutableOf` etc in std.traits – they don't seem to be of any public use since `const(T)` is more direct and meaningful than `ConstOf!T`.
Except for `MutableOf` they are all currently public and even the `package`- level `MutableOf` is publicly documented. All this seems pointless.
Of course they are used in the implementation of std.variant but for that they all can be marked `package` and they don't need to be publicly documented.
They are also used for making the internal life of QualifierOf easier, but QualifierOf itself is not publicly documented.
Is QualifierOf intended to be publicly used? What is the difference in final utility between QualifierOf and CopyTypeQualifiers?
Thanks!
--
Shriramana Sharma, Penguin #395953
| ||||
October 21, 2015 Re: MutableOf etc and QualifierOf | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Shriramana Sharma | On Wednesday, 21 October 2015 at 12:22:25 UTC, Shriramana Sharma wrote: > The templates `MutableOf` etc in std.traits – they don't seem to be of any public use since `const(T)` is more direct and meaningful than `ConstOf!T`. > > Except for `MutableOf` they are all currently public and even the `package`- level `MutableOf` is publicly documented. All this seems pointless. > > Of course they are used in the implementation of std.variant but for that they all can be marked `package` and they don't need to be publicly documented. > > They are also used for making the internal life of QualifierOf easier, but QualifierOf itself is not publicly documented. > > Is QualifierOf intended to be publicly used? What is the difference in final utility between QualifierOf and CopyTypeQualifiers? > > Thanks! It might be better to ask in http://forum.dlang.org/group/learn first for these sort of questions. One reason is that it interacts with constructs like std.meta.staticMap, e.g. alias constTypes(T ...) = staticMap!(ConstOf, T); | |||
October 21, 2015 Re: MutableOf etc and QualifierOf | ||||
|---|---|---|---|---|
| ||||
Posted in reply to John Colvin | John Colvin wrote: > It might be better to ask in http://forum.dlang.org/group/learn first for these sort of questions. I didn't do that only because it concerns implemental details of Phobos which didn't seem to be learner material. I have just now separately posted an actual "I don't know why this doesn't work" question over there. I do use both fora for different things. > One reason is that it interacts with constructs like std.meta.staticMap, e.g. > > alias constTypes(T ...) = staticMap!(ConstOf, T); But even then it's enough if these are marked `package`, no? -- Shriramana Sharma, Penguin #395953 | |||
October 21, 2015 Re: MutableOf etc and QualifierOf | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Shriramana Sharma | On Wednesday, 21 October 2015 at 14:27:45 UTC, Shriramana Sharma wrote:
> John Colvin wrote:
>
>> It might be better to ask in http://forum.dlang.org/group/learn first for these sort of questions.
>
> I didn't do that only because it concerns implemental details of Phobos which didn't seem to be learner material. I have just now separately posted an actual "I don't know why this doesn't work" question over there. I do use both fora for different things.
>
>> One reason is that it interacts with constructs like std.meta.staticMap, e.g.
>>
>> alias constTypes(T ...) = staticMap!(ConstOf, T);
>
> But even then it's enough if these are marked `package`, no?
No, I meant that as an example of user code, not necessarily something in phobos.
It's just a convenience. Sure, the user could write
alias constOf(T) = const(T);
themselves, but for better or worse, it's in std.traits so they don't have to.
| |||
October 21, 2015 Re: MutableOf etc and QualifierOf | ||||
|---|---|---|---|---|
| ||||
Posted in reply to John Colvin | John Colvin wrote: > for better or worse, it's in std.traits so they > don't have to. Heh, I thought the library was supposed to provide what the basic language itself doesn't provide... -- Shriramana Sharma, Penguin #395953 | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply