Proof of concept - library AA

IgorStepanov via Digitalmars-d digitalmars-d at puremagic.com
Mon May 25 16:39:17 PDT 2015


On Sunday, 24 May 2015 at 14:13:26 UTC, Martin Nowak wrote:
> Would be interesting to get some opinions on this.
>
> https://github.com/D-Programming-Language/druntime/pull/1282

BTW, I have one idea. We may declare the AA ABI:
AA is a pointer to the next layout:

__vtbl
N bytes of data

and __vtbl is a pointer to a struct:
struct AAVTBL
{
     size_t function() size; //returns the size of AA object: N + 
(AABTBL*).sizeof
     void* get(void* aa, @somefields@)
     //another function
}

And it we teach compiler to use this ABI, we may say that any 
type which follows this ABI is a correct associative array.
At the first stage, we may adapt the existing AA implementation 
to follow this ABI, and adapt the compiler to use it.
After that, we will adble to write library AA (which also follows 
this ABI), which may be constructed as general D type, and casted 
to AA later.




More information about the Digitalmars-d mailing list