Q: Is there a (different) work-around for AA.keys problems?
Austin Hastings
ah08010-d at yahoo.com
Sat Jan 29 08:29:35 PST 2011
The hackAroundBug()/typeid approach didn't work for me - I still got the
error 42. Presently, I'm using a local method, but this is annoying for
obvious reasons:
string[] aa_keys( int[ string ] aa )
{
return aa.keys;
}
Even more annoying is that this works, while a simple reference to the
member.keys in the calling method doesn't. I wonder if this is caused by
the AA being inside an object?
=Austin
On 1/29/2011 11:17 AM, Adam D. Ruppe wrote:
> Shooting in the dark here (I can't reproduce the error for
> whatever reason), but for similar problems, I've found this fixes
> it:
>
> Add a function somewhere in your file that says:
>
> void hackAroundBug() {
> writeln(typeid(int[string]));
> }
>
> You never actually need to call it. Just putting it there gives
> the compiler that extra nudge to put the symbol back into the
> object file.
>
>
> The error I saw was related to .rehash being missing, but it
> fixed it for me and might work here too.
>
>
> My older method was to add
>
> -I/home/me/d/dmd2/src/druntime/src /home/me/d/dmd2/src/druntime/src/object_.d -d
>
> On to the DMD command line (object_.d has the code needed for
> various AA things). Of course remember to fix the paths there
> to your dmd source.
>
> But with the referencing typeinfo workaround, I haven't needed
> to do this at all anymore.
More information about the Digitalmars-d
mailing list