Skip to content

std.algorithms: document public methods #4312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2016

Conversation

wilzbach
Copy link
Member

Here's a small project that I intend to do when I am on the road - document the public methods in Phobos or set them private etc ;-)
As you can imagine, many parts in Phobos aren't properly ddoced - so let's do this bit by bit.

If someone wants to help out, here's the current output of dscanner.

There are some fixes which might be controversial - I will mark them so.

// @@@BUG@@@
//return haystack[$ .. $];
return haystack[haystack.length .. haystack.length];
return haystack[$ .. $];
Copy link
Member Author

Choose a reason for hiding this comment

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

it seems to me that this bug is fixed?

@wilzbach wilzbach force-pushed the public_document_algorithms branch from 3fca1c8 to 5689a48 Compare May 12, 2016 12:36
@@ -1938,7 +1938,7 @@ if (isRandomAccessRange!R1 && isForwardRange!R2 && !isBidirectionalRange!R2 &&

// Internally used by some find() overloads above. Can't make it
// private due to bugs in the compiler.
/*private*/ R1 simpleMindedFind(alias pred, R1, R2)(R1 haystack, R2 needle)
private R1 simpleMindedFind(alias pred, R1, R2)(R1 haystack, R2 needle)
Copy link
Member Author

Choose a reason for hiding this comment

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

it seems that this bug is fixed?

@JackStouffer
Copy link
Member

@burner IIRC you're the one who made all of the alias string this overloads, any reason they shouldn't be documented?

@burner
Copy link
Member

burner commented May 12, 2016

@JackStouffer I don't recall this. Anyway, if they are public functions and are supposed to be public then the should be documented.

@burner
Copy link
Member

burner commented May 12, 2016

this PR is mixing documentation with general maintenance and visibility changes. Could you split that into multiple PRs. That would make reviewing easier and thereby make pulling or closing faster.

@@ -1319,7 +1319,7 @@ private struct FilterBidiResult(alias pred, Range)
}
}

// group
/// group
struct Group(alias pred, R) if (isInputRange!R)
Copy link
Member

Choose a reason for hiding this comment

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

This should be under the same docs as its factory function. Same goes for all of the public range structs.

Copy link
Member Author

Choose a reason for hiding this comment

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

so /// ditto?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, and you should move it to under the factory function. No one should be using the struct directly, but since it's public we can't make it a static struct without deprecation cycles that are of questional value anyway.

@wilzbach
Copy link
Member Author

this PR is mixing documentation with general maintenance and visibility changes. Could you split that into multiple PRs. That would make reviewing easier and thereby make pulling or closing faster.

@burner so that I understand right - setting accidentally exposed symbols to private should be a separate PR?

@burner
Copy link
Member

burner commented May 12, 2016

@wilzbach yes, because it is a bugfix and not a documentation change. As said, this will speed the whole process. The little extra time you will spend branching you will make back double/tripple during review.

struct Permutations(Range)
if (isRandomAccessRange!Range && hasLength!Range)
{
size_t[] indices, state;
Range r;
private size_t[] indices, state;
Copy link
Member

Choose a reason for hiding this comment

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

You need to deprecate these, perferably in a different PR. See https://github.com/dlang/phobos/pull/3950/files

@wilzbach wilzbach force-pushed the public_document_algorithms branch from 5689a48 to 6793405 Compare May 12, 2016 14:51
@wilzbach wilzbach force-pushed the public_document_algorithms branch from 6793405 to b8f17e2 Compare May 12, 2016 14:53
@wilzbach
Copy link
Member Author

@wilzbach yes, because it is a bugfix and not a documentation change. As said, this will speed the whole process. The little extra time you will spend branching you will make back double/tripple during review.

done - this PR now only contains documentation changes and as @JackStouffer suggested I moved undocumented struct's below the method and added the magic /// ditto.

@JackStouffer
Copy link
Member

LGTM

@wilzbach
Copy link
Member Author

LGTM

ping

@schveiguy
Copy link
Member

Based on the recent discussions on Voldemort types, I wonder, shouldn't these actually be Voldemort? I wouldn't make them so, because this can bloat the binary incredibly fast. But I don't know if we should expose the types as public API.

I'm working on a possible solution to the bloat that would allow us to have the types as Voldemort but not with the bloat.

@burner
Copy link
Member

burner commented May 23, 2016

LGTM

@burner
Copy link
Member

burner commented May 23, 2016

Auto-merge toggled on

@wilzbach
Copy link
Member Author

But I don't know if we should expose the types as public API.

This just adds them to the documentation output - they are already publicly exposed and would need a deprecation cycle if we make them private/Voldemort again,.

@schveiguy
Copy link
Member

(as an aside, github is really borked for me today, it doesn't show all the discussion).

It's a much easier deprecation to remove undocumented public symbols than it is to remove public API.

@schveiguy
Copy link
Member

In any case, we have until the next major release to decide.

@burner
Copy link
Member

burner commented May 23, 2016

I did just turn auto merge on. but github does not display it. Lets see what explodes and then take action

@burner burner merged commit 836a905 into dlang:master May 23, 2016
@wilzbach wilzbach deleted the public_document_algorithms branch June 8, 2016 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants