Skip to content

Comments

Unify overloads and documentation for formatValue#5923

Merged
dlang-bot merged 4 commits intodlang:masterfrom
JackStouffer:formatValue
Dec 14, 2017
Merged

Unify overloads and documentation for formatValue#5923
dlang-bot merged 4 commits intodlang:masterfrom
JackStouffer:formatValue

Conversation

@JackStouffer
Copy link
Contributor

In the vein of #5191 and #4208, this hides all of the individual overloads of formatValue and brings the documentation and examples into one place.

This is especially useful in the ddox version of the docs, as every overload will no longer be shown on a different page.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @JackStouffer!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

Ha! I was doing the same today, but I didn't come around submitting it yet - you bet me to it.
I would leave the full documentation for the individual overloads, but apart from this it already looks good!

std/format.d Outdated
}

/*
Bools
Copy link
Contributor

Choose a reason for hiding this comment

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

I would leave the full comment line here, e. g.

bools are formatted as "true"or"false"with%sand as1or0` with integral-specific format specs.

In this case

@JackStouffer
Copy link
Contributor Author

@wilzbach Done

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

Alrighty. LGTM on a glance from my phone. I will go line by line over it later or tomorrow from my notebook and merge this if no one objects until then.

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

I found a few nits, but they aren't related to your precise work, but I found them in the existing code. I will append a commit for these nits to your PR, so if you don't agree you can always drop it.

std/format.d Outdated
*
* Params:
* w = The $(REF_ALTTEXT output _range, isOutputRange, std,_range,primitives) to write to.
* obj = The value to write.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: some formatValue implementation even call this val and as this function is called formatVALue I think val would be a better fit for the name of this parameter.
The reason why some implementations called it obj is that they then can define sth. like BooleanTypeOf!T val = obj; in their first line and use val consistently.

std/format.d Outdated
*
* Specializations:
* $(UL $(LI $(D void[]) is formatted like $(D ubyte[]).)
* $(LI Const array is converted to input range by removing its qualifier.))
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: typical formatting of this is:

$(UL
   $(LI $(D void[]) is formatted like $(D ubyte[]).)
   $(LI Const array is converted to input range by removing its qualifier.)
)

as then it's a lot easier to keep track of the parentheses manually.

(I'm aware that you just copied it 1:1 from the function declaration.)

std/format.d Outdated
*/
@system unittest
{
import std.format;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is superfluous - you are already within std.format

(I am aware that this is an old relict)

@system int delegate(short) @nogc bar() nothrow pure
{
int* p = new int;
return &foo;
Copy link
Contributor

Choose a reason for hiding this comment

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

The function body seems unused. It could be dropped - this will then also increase the coverage and remove the red bits.

@dlang-bot dlang-bot merged commit 5964600 into dlang:master Dec 14, 2017
@JackStouffer JackStouffer deleted the formatValue branch December 14, 2017 14:42
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