www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - MutableOf etc and QualifierOf

reply Shriramana Sharma <samjnaa_dont_spam_me gmail.com> writes:
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
Oct 21 2015
parent reply John Colvin <john.loughran.colvin gmail.com> writes:
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);
Oct 21 2015
parent reply Shriramana Sharma <samjnaa_dont_spam_me gmail.com> writes:
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
Oct 21 2015
parent reply John Colvin <john.loughran.colvin gmail.com> writes:
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.
Oct 21 2015
parent Shriramana Sharma <samjnaa_dont_spam_me gmail.com> writes:
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
Oct 21 2015