[WIP] Aa lower lib - work in progress#1985
Conversation
|
Thanks for your pull request and interest in making D better, @somzzz! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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 referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
|
ping @quickfur as I think you attempted something like this at one point. |
andralex
left a comment
There was a problem hiding this comment.
OK, so did you get to build successfully with these changes?
| @@ -0,0 +1,1046 @@ | |||
| /** | |||
| * Implementation of associative arrays. | |||
There was a problem hiding this comment.
s/Implementation/Templated implementation/
| private enum HASH_DELETED = 0x1; | ||
| private enum HASH_FILLED_MARK = size_t(1) << 8 * size_t.sizeof - 1; | ||
|
|
||
| private @property bool empty(in AssocArray!(void, void)* aa) pure nothrow @nogc |
There was a problem hiding this comment.
Shouldn't all functions in this module be vacuous templates so as to force on-demand compilation? I mean:
private @property bool empty()(in AssocArray!(void, void)* aa) pure nothrow @nogc| } | ||
|
|
||
|
|
||
| bool hasPostblit(in TypeInfo ti) |
| return ti; | ||
| } | ||
|
|
||
| struct AssocArray(K, V) |
There was a problem hiding this comment.
Great, the methods inside this struct don't need to be vacuous templates because they already are templates as members of a template struct.
| } | ||
| return ti; | ||
| } | ||
|
|
There was a problem hiding this comment.
Please insert a comment explaining what AssocArray is and does.
|
I haven't looked into this in detail yet, but from a cursory glance, I have the following comments:
|
This is a WIP on a difficult goal and we decided to first go through a proof of concepts stage whereby
Indeed. That is intentional. We want to make sure the lowering generates correct calls to methods of a template type.
Agreed. Yes, the plan is to move to a non-Typeinfo implementation.
We'll indeed look forward to improvements once we get the templated basics in place.
I think we already have that (which may cause difficulty to this project). |
|
@somzzz please rebase |
|
@andralex Thanks for clarifying. Using |
|
You should use some git rename command for rt.aaa.d -> assoc_array.d to not lose history and make it a lot easier to review actual changes. |
| } | ||
|
|
||
| //============================================================================== | ||
| // API AssocArrayementation |
| * If key was not in the aa, a mutable pointer to newly inserted value which | ||
| * is set to all zeros | ||
| */ | ||
| extern (C) void* _aaGetY(AssocArray!(void, void)** aa, const TypeInfo_AssociativeArray ti, in size_t valsz, |
There was a problem hiding this comment.
maybe use ref AssocArray!(void, void)* aa here to avoid repeating (*aa) below. Or assign it to some local.
| /* | ||
| public template AssocArray(K, V) | ||
| { | ||
| import assoc_array; |
There was a problem hiding this comment.
Good to see the import being delayed here. I'd recommend to put assoc_array into some sub package of core or core.internal, though.
@RazvanN7