Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

[rt/aaA] Add _aaNew function to initialize AA #3863

Merged
merged 2 commits into from
Jul 3, 2022
Merged

Conversation

ntrel
Copy link
Contributor

@ntrel ntrel commented Jun 29, 2022

Add druntime support to initialize an AA. Currently you have to add and then remove a dummy key/value pair to actually allocate the AA. This is needed if you want to give out references to the same AA before populating it.
https://issues.dlang.org/show_bug.cgi?id=10535

The syntax to do this will be new AA. I suggested that syntax and it was supported by @jacob-carlborg and @rainers here: #2504 (comment)

I have the dmd counterpart ready to submit. dlang/dmd#14257

@ntrel ntrel requested review from andralex and wilzbach as code owners June 29, 2022 16:05
@dlang-bot
Copy link
Contributor

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

src/rt/aaA.d Outdated
@@ -485,6 +485,14 @@ pure nothrow @nogc unittest
// API Implementation
//------------------------------------------------------------------------------

/// Allocate new AA implementation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add documentation like e.g. #3865 (cc @dkorpel)
In particular, mention when this function is called by the compiler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated docs.

@dkorpel dkorpel merged commit f71d42e into dlang:master Jul 3, 2022
ntrel added a commit to ntrel/druntime that referenced this pull request Jul 5, 2022
_aaNew was added recently in dlang#3863.
This is consistent with `_d_assocarrayliteralTX` returning `Impl*`.

Also flesh out docs for _d_assocarrayliteralTX.
@ntrel ntrel deleted the new-aa branch July 5, 2022 17:37
@schveiguy
Copy link
Member

Oh man, this is awesome! Great idea!

dlang-bot pushed a commit that referenced this pull request Jul 5, 2022
_aaNew was added recently in #3863.
This is consistent with `_d_assocarrayliteralTX` returning `Impl*`.

Also flesh out docs for _d_assocarrayliteralTX.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants