On Wednesday, 14 March 2012 at 13:55:23 UTC, Don Clugston wrote:
On 14/03/12 03:39, Jakob Bornecrantz 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.

Much less so than the existing AA implementation.

In what way moving the entire implementation into templates
that gets compiled into the object code of all the uses, got
to be worse (for ABI) then having the implementation separate?

I think you are not seeing the implementation off calling
into the opaque implementation as two separate things. Yes the
current implementation off calling into is bad and should be
replaced.

Ponder this for example:

struct AA(K, V)
{
  void *ptr;

  void init() { ptr = rt_aaInit(typeinfo!K, typeinfo!V; }

  static if (isData!K)
void add(K k, V ref v) { rt_aaAddData(ptr, cast(ulong)k, v); }
  else static if (isPointer!K)
void add(K k, V ref v) { rt_aaAddPointerWithHash(ptr, k, toHash!K(k), v); }
  else
     void add(K ref k, V ref v) { rt_aaAdd(ptr, k, v); }
}

Adding to this implementation wouldn't require changing DMD
at all only _object.d and the aa implementation in druntime.

The use of the AA struct isn't required by the ABI, only
that functions gets called for doing things to a AA.


Cheers, Jakob.

Reply via email to