Skip to content

Comments

Refactor std.traits.EnumMembers#8260

Merged
dlang-bot merged 1 commit intodlang:masterfrom
pbackus:refactor-enum-members
Oct 3, 2021
Merged

Refactor std.traits.EnumMembers#8260
dlang-bot merged 1 commit intodlang:masterfrom
pbackus:refactor-enum-members

Conversation

@pbackus
Copy link
Contributor

@pbackus pbackus commented Oct 3, 2021

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @pbackus! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

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.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#8260"

@adamdruppe
Copy link
Contributor

very beautiful and it passes CI. If I could merge I would.

@dlang-bot dlang-bot merged commit 2cb2d6c into dlang:master Oct 3, 2021
@nordlow
Copy link
Contributor

nordlow commented Oct 4, 2021

This might reduce memory consumption. Have you done any memory benchmarks on std.traits, @pbackus?

@pbackus
Copy link
Contributor Author

pbackus commented Oct 4, 2021

@nordlow I have not. My guess is that this change would not have much impact on its own, but would increase the value of #8039, since it moves the recursion out of EnumMembers and into staticMap.

alias EnumSpecificMembers = AliasSeq!();
}
}
import std.meta : Map = staticMap;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you keep the alias Map instead of using the staticMap directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm trying to start a trend. :)

More seriously: std.meta has a lot of weird naming inconsistencies—compare staticMap, Filter, and templateOr, for example. I think smoothing out these inconsistencies with renamed imports makes code easier to read, and would like to see the practice catch on in Phobos. With local imports, the potential for confusion is low, since one only has to scroll a few lines to see where the alias is defined.

Copy link
Contributor

@nordlow nordlow Oct 4, 2021

Choose a reason for hiding this comment

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

Ahh, good point. I guess an alias is lightweight enough to serve this purpose. ;)

Thanks. Keep up the awesome work.

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.

5 participants