core.traits?

Steven Schveighoffer schveiguy at gmail.com
Tue Jan 8 19:54:17 UTC 2019


On 1/8/19 1:59 PM, Nick Treleaven wrote:
> On Monday, 7 January 2019 at 21:54:15 UTC, Steven Schveighoffer wrote:
>> std.internal.traits contains pieces of std.meta -- a quick look shows 
>> it has AliasSeq (but under the name TypeTuple),
> 
> That's fine internally, but std.traits still uses *Tuple for ten public 
> templates:
> https://github.com/dlang/phobos/pull/6227
> 
> If we move any of those to core.traits, please can we finally fix the 
> names.

You'd have to convince Andrei, as he seemingly nixed the PR.

>> traits and meta are really part of the language,
> 
> Some in std.traits are tightly coupled to the language, e.g. isInteger. 
> Some are utility templates, e.g. ConstOf, CopyConstness. I think only 
> the former should be public in druntime. Select and select aren't even 
> traits, they should have been in std.meta.

What I mean is that you reach for things like what is available in 
std.traits quite often when doing template constraints or type 
manipulation. I'd consider ConstOf and CopyConstness to be in that group.

> Except perhaps AliasSeq, (Alias, Instantiate) all of std.meta seems to 
> be utility templates rather than language feature wrappers.

What I mean is that I consider them part of D language, not like a 
library feature that is optional.

But in any case, much of std.traits relies on std.meta. We would at 
least need the parts in std.meta that are used to build std.traits.

-Steve


More information about the Digitalmars-d mailing list