Library associative array project v0.0.1

H. S. Teoh hsteoh at quickfur.ath.cx
Thu May 12 17:15:26 UTC 2022


On Wed, May 11, 2022 at 11:31:02AM -0400, Steven Schveighoffer via Digitalmars-d-announce wrote:
> I just spent a couple hours making a library AA solution that is
> binary compatible with druntime's builtin AA.

This is awesome!  Don't have time to look at it in detail right now, but
will definitely keep this in mind.


> The benefits:
> 
> 1. Proves that a library implementation is possible, also shows where
> shortcomings are.

What are the shortcomings that you found?


> 2. Usable at compile time to make an AA that can be used at runtime.

Awesome.


> 3. Much more approachable code than the AA runtime, does not require
> "faking" a typeinfo, dealing with typeinfo in general, or deal with
> magic compiler hooks. This gives a good base to start experimenting
> with.

Awesome.


> For the future:
> 
> 1. Implement all the things that AAs can do (which are possible, some
> are not).

Which things are not possible to do?


> 2. Look at alternatives to GC for allocation/deallocation.
> 3. Possible use with betterC?
[...]

Just use malloc/free?  Could have problems with dangling references to
buckets, though, if somebody retains the pointer returned by `key in
aa` expressions.  Or use ref-counting of some sort.  But hard to do this
without changing binary compatibility.


T

-- 
"You know, maybe we don't *need* enemies." "Yeah, best friends are about all I can take." -- Calvin & Hobbes


More information about the Digitalmars-d-announce mailing list