Skip to content
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

Add std.typecons.Rebindable2 for internal use. #8768

Merged

Conversation

FeepingCreature
Copy link
Contributor

@FeepingCreature FeepingCreature commented Jun 19, 2023

Rebindable2 is a simplified version of std.typecons.Rebindable that cleans up every special case: classes, arrays and structs now have the same struct Rebindable2.

Whichever type you instantiate Rebindable2 with, you always get the same type out by calling value.get on the resulting container.

Also use this type to simplify the parts of Phobos I previously used Rebindable for.

This PR is the announced follow-up to #8735

Rebindable2 is a simplified version of std.typecons.Rebindable that clears up every special case: classes, arrays and structs now have the same struct.
Whichever type you instantiate `Rebindable2` with, you always get the same type out by calling `value.get` on the resulting container.
Also use this type to simplify the parts of Phobos we previously used `Rebindable` for.
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @FeepingCreature! 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#8768"

@atilaneves
Copy link
Contributor

We need a better name than Rebindable2.

@FeepingCreature
Copy link
Contributor Author

The thing is that Rebindable is genuinely a really good name for this type. You bind a value to a name when declaring a variable; Rebindable lets you dissolve that association and bind a new value to the same name.

@dkorpel
Copy link
Contributor

dkorpel commented Jun 20, 2023

We need a better name than Rebindable2.

Since the symbol isn't public, there's no hurry to give it a final name.

@dkorpel dkorpel merged commit 7f10ebc into dlang:master Jun 21, 2023
@FeepingCreature FeepingCreature deleted the feature/add-typecons-rebindable2 branch June 21, 2023 09:58
FeepingCreature added a commit to FeepingCreature/phobos that referenced this pull request Jul 3, 2023
Non-mutable `class` is another case where `Rebindable` just silently aliases itself away.
Don't sweat that this looks ugly - this is fixed on `master` via the `Rebindable2` rewrite dlang#8768
FeepingCreature added a commit to FeepingCreature/phobos that referenced this pull request Jul 3, 2023
Non-const `class` is another case where `Rebindable` just silently aliases itself away.
Don't sweat that this looks ugly - this is fixed on `master` via the `Rebindable2` rewrite dlang#8768
FeepingCreature added a commit to FeepingCreature/phobos that referenced this pull request Jul 3, 2023
… `Rebindable` did in fact alias itself away.

This looks ugly, but it's just for the `stable` branch - this is fixed on `master` via the `Rebindable2` rewrite dlang#8768
dlang-bot pushed a commit that referenced this pull request Jul 3, 2023
… `Rebindable` did in fact alias itself away.

This looks ugly, but it's just for the `stable` branch - this is fixed on `master` via the `Rebindable2` rewrite #8768
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