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 note to Unqualified about is(immutable T == immutable U). #9091

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

jmdavis
Copy link
Member

@jmdavis jmdavis commented Nov 25, 2024

In many cases, even when using Unqualified makes sense (as opposed to Unconst or Unshared), using is(immutable T == immutable U) works just as well and avoids instantiating any additional templates. This seems to becoming more known in the D community over time, but it seems appropriate to mention it in Unqualified's documentation so that more people will be made aware.

Also, I changed it so that Unqualified is always a wrapper template instead of directly being an alias of Unqual in core.internal.traits. This is because the names don't match, and the alias will show up in any error messages. Long term, we would ideally rename the symbol in core.internal (potentially turning the std.traits versions into a wrapper templates instead of an alias). However, since the functionality is effectively the same, and the std.traits one is the one currently being used by code in general, it seems better to let the std.traits one be the alias for now. The same applies to a few traits which are implemented in core.internal.traits and imported in std.traits or phobos.sys.traits.

In many cases, even when using Unqualified makes sense (as opposed to
Unconst or Unshared), using is(immutable T == immutable U) works just as
well and avoids instantiating any additional templates. This seems to
becoming more known in the D community over time, but it seems
appropriate to mention it in Unqualified's documentation so that more
people will be made aware.

Also, I changed it so that Unqualified is always a wrapper template
instead of directly being an alias of Unqual in core.internal.traits.
This is because the names don't match, and the alias will show up in any
error messages. Long term, we would ideally rename the symbol in
core.internal (potentially turning the std.traits versions into a
wrapper templates instead of an alias). However, since the functionality
is effectively the same, and the std.traits one is the one currently
being used by code in general, it seems better to let the std.traits one
be the alias for now. The same applies to a few traits which are
implemented in core.internal.traits and imported in std.traits or
phobos.sys.traits.
@jmdavis jmdavis added the Phobos 3 The PR is for Phobos V3. label Nov 25, 2024
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @jmdavis!

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#9091"

@dlang-bot dlang-bot merged commit 5d16daf into dlang:master Nov 25, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merge:auto-merge Phobos 3 The PR is for Phobos V3.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants