[dmd-internals] AssociativeArray in druntime should go before the next release

Brad Roberts braddr at puremagic.com
Thu Feb 2 08:16:37 PST 2012


Meaning return to before there was an AA type in object.d or complete the transition to just the object.d version (which
would include moving the code hidden off in the runtime into either object.d or a file imported publically by object.d)?

I'd prefer the latter.

On 2/2/2012 7:46 AM, Don Clugston wrote:
> I agree completely. In Bugzilla, I found FIFTEEN reported compiler
> regressions caused by the introduction of library AAs. Most were very
> difficult to fix; in many cases the fix is very fragile.
> 
> Another issue that wasn't on your list: AA literals don't have a
> representation outside of the compiler, yet they are a crucial
> implementation issue.
> 
> Take at look at this code in object.di, it's really incredible:
> 
> struct AssociativeArray(Key, Value)
> {
>    void* p; // really Hashtable*
> 
>     Value get(Key key, lazy Value defaultValue)
>     {
>         auto p = key in *cast(Value[Key]*)(&p);   <------ Think about
> what happens here.
>         return p ? *p : defaultValue;
>     }
> }
> 
> The CTFE code to cope with this sort of thing is truly awful.
> 
> The D2 AA implementation is a pack of cards. If you make a small
> change, it will break.
> And it's getting worse. So far, every fix has made the compiler more
> complicated and more closely tied to the runtime, in very subtle ways.
> 
> I think we should cut our losses, and roll it back. This particular
> approach is a disaster.
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals



More information about the dmd-internals mailing list