-
-
Notifications
You must be signed in to change notification settings - Fork 740
Convert std.random to a package #3406
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
Conversation
Apologies for the lack of rebase, fixing that now. |
132077c
to
7ab6874
Compare
Rebased. Just my luck to be pushing this PR as the design of I may have accidentally lost Lionello's recent minor Ddoc patch in the process, but no doubt that can be sorted out in the wash. |
This patch does the most basic work of converting std.random to being a package, with corresponding updates to the makefiles.
This patch introduces the intended module structure for the new package, according to the following classifications of functionality: * random _engines_, i.e. sources of uniformly distributed pseudo-random bits; * random _devices_, i.e. sources of uniformly distributed non-deterministic random bits; * random _distributions_, which transform random bits into variates with other statistical properties; * random _algorithms_, i.e. algorithms whose outcome has a random component; * traits for use with random number generation. As a first step, the new modules have been created without copying any code, merely providing a module header and documentation. The makefiles have been updated accordingly.
As far as I can tell, the code which this comment referred to was introduced with the very first implementation of std.random in commit cf1172c, and the comment has persisted despite the code it referred to long being removed.
OK, with no feedback so far, I'm going to try to fix up the Windows makefiles. In the absence of my own Windows setup, I'm going to rebase and push one patch at a time, making sure that things pass. Apologies for the abuse of the testing framework ... ! |
7ab6874
to
0231519
Compare
Remaining patches will be pushed tomorrow. |
It's an absolutely valid use case. ;) |
Good to know :-) The last of the code-changing patches has now been pushed -- the remainder are documentation and comment tweaks. Since this PR is technically creating new modules, do I need to request it be added to the Review Queue? http://wiki.dlang.org/Review_Queue |
Don't think so. Packaging modules is non-controversial thing we are doing for some time now. A discussion on forums might be in order though, just to get some attention. |
Great, I'll do that once I've finished pushing all the patches. Thanks very much! |
Last patch has been pushed. I think this is now 100% ready for review. |
Most obvious immediate issue from my point of view: the documentation for modules seems a bit screwy, as the individual methods of various structs are now being given their own documentation pages. Not sure if this is intentional or accidental, it looks overkill to me. |
You are changing some Phobos modules that used to |
Importing sub-package modules is better b/c of pulling in less dependencies. It's not required but strongly recomened for any library module to reduce its dependencies to bare minimum. Phobos is a library. |
No, they are not necessary, but it seemed in line with current phobos practice to prefer importing in this more fine-grained way, for the reasons @DmitryOlshansky has already mentioned.
It is sufficient. You can
It should not cause any external code breakage.
I'm talking about the documentation that the auto-tester built: In particular, I find it odd that it now generates pages like this: |
I see. I didn't look at the individual commits. Regarding the generated documentation: I think it looks odd because some functions are documented in the old style. You can fix the documentation if you want. |
One more question. Am I right that the only thing that makes |
I think the use of |
BTW, Jonathan M. Davis raised this interesting objection to the PR as it stands: |
I think all other std/*.d should be left alone by this PR. If anything they'd stand as some proof that the changes don't break things. |
I'm unsure what's your definition of non-deterministic? And it is somewhat important because |
I wasn't at dconf. But Jonathan is right that it seems to be the better option to first iron out how random should look like and then later decide on migration/deprecation. This allows you to do a less constrained design (results in a better design in the end). In my opinion go for |
Fair enough. Re the general PR: I'm probably going to be slow following up on this anyway (there have been some busy weeks and more are anticipated). So let's let this lie for now, and I'll try and follow up with some more concrete "next-gen" code (even if it's just a proof-of-concept). Then we can decide how to proceed. If people want the PR closed until there is follow-up, that's fine. |
Regarding |
Ping @WebDrake - I think your idea to reorganize random is great! Do you have some time to push it through? How about submitting your changes to the other modules in a follow-up PR? |
I am closing this now with regrets due to its inactivity and lack of interest. @WebDrake Feel free to resubmit this if you want to push this - otherwise your contributions to mir-random are equally welcome :) |
@wilzbach I think closing this is the right decision; TBH I don't think it should have stayed open for so long. The reason for the lack of inactivity isn't unwillingness to make it happen per se, but the feedback from @jmdavis that it would be better to solve the foundational problems of std.random before breaking it out into a package. I agreed with that feedback, otherwise this PR would have been completed long ago. |
As mooted at DConf, this PR converts
std.random
into a package layout clearly distinguishing between the different types of functionality available:A
std.random.traits
module has also been included to house RNG-related template checks.