Replacing AA's in druntime

Jakob Bornecrantz wallbraker at gmail.com
Wed Mar 14 16:20:43 PDT 2012


On Wednesday, 14 March 2012 at 14:02:30 UTC, Steven Schveighoffer 
wrote:
> On Tue, 13 Mar 2012 22:39:25 -0400, Jakob Bornecrantz 
> <wallbraker at gmail.com> wrote:
>
>> On Wednesday, 14 March 2012 at 00:52:32 UTC, H. S. Teoh wrote:
>>> Hi all,
>>>
>>> My AA implementation is slowly inching closer to being ready 
>>> to replace aaA.d. So far I've been writing the implementation
>>> outside of object_.d for ease of testing & development; now 
>>> I'm
>>> ready to start moving stuff into object_.d to start working on
>>> integration with druntime.
>>
>> Hi,
>>
>> If I'm understanding this correctly you are moving the entire
>> implementation of the AA into object.d and as such letting
>> programs be purview to its inner working? In sort meaning you
>> are making the entire AA implementation D ABI locked.
>>
>> This will make it impossible to either change the AA
>> implementation in any ABI breaking fashion or make it 
>> impossible
>> to pass AA's between libraries compiled against different
>> versions of druntime.
>>
>> Is this what we really want?
>
> This is unavoidable, whether it's a template or not.  What 
> changes do you envision would be transparent using an opaque 
> pImpl model (as was done in previous versions of phobos), but 
> would break using templates?

struct AAver1(K, V)
{
    K[] tbl; V[] tlb2; uint size;
}

struct AAver2(K, V)
{
    K[] tbl; V[] tbl2; V[] optimizationTbl;
}

Would break if a AAver1 table was ever passed to code that
was compiled against a AAver2 table. In sort you could never
add anything to the AA struct. Without going in roundabout
ways of making sure you never access outside of any struct
version ever out there.

Or for that matter change how the internal tables are
populated by add and remove.

Cheers, Jakob.


More information about the Digitalmars-d mailing list