Skip to content

Improve some docs in std.traits#5287

Merged
dlang-bot merged 1 commit intodlang:masterfrom
JackStouffer:traits-docs
Mar 18, 2017
Merged

Improve some docs in std.traits#5287
dlang-bot merged 1 commit intodlang:masterfrom
JackStouffer:traits-docs

Conversation

@JackStouffer
Copy link
Contributor

No description provided.

std/traits.d Outdated
static assert(isIntegral!int);
static assert(isIntegral!long);

static assert(!isIntegral!double);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add tests for bool and char please.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For compactness you may group all true asserts together and all false asserts together:

static assert(isIntegral!byte && isIntegral!short && ...);
static assert(!isIntegral!double && ...);

In fact if you exhaustively enumerate all cases for true there's no need for example for false.

std/traits.d Outdated
struct S
{
int val;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would there ever be an empty line in a 4-line struct... cc @wilzbach

std/traits.d Outdated
{
static assert(isFloatingPoint!float);
static assert(isFloatingPoint!double);
static assert(isFloatingPoint!real);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a qualifier somewhere to clarify it works with qualifiers as well

@JackStouffer
Copy link
Contributor Author

JackStouffer commented Mar 18, 2017

@andralex These tests are purely for documentation. The more comprehensive tests for these traits already exist below these.

@JackStouffer JackStouffer force-pushed the traits-docs branch 2 times, most recently from 67b3768 to 0b25088 Compare March 18, 2017 16:52
@andralex
Copy link
Member

I understand, but really "how about char and bool?" and "does it work with qualifiers?" are the first that come to any user's mind!

@JackStouffer JackStouffer force-pushed the traits-docs branch 3 times, most recently from c15d598 to b77cabe Compare March 18, 2017 19:34
@JackStouffer
Copy link
Contributor Author

@andralex Integrated your suggestions while still trying to keep it as clear as possible.

@dlang-bot dlang-bot merged commit 09ae19f into dlang:master Mar 18, 2017
@JackStouffer JackStouffer deleted the traits-docs branch July 7, 2017 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants