www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Any othe options for inserting into associative array?

reply Jesse Phillips <jessekphillips+D gmail.com> writes:
Came across this when trying to get Juno to work. Is there a good workaround
for it?

http://d.puremagic.com/issues/show_bug.cgi?id=6906

test.d(6): Error: function test.S.opAssign (int i) is not callable using
argument types (S)

    void main() {
       S[string] ss;
       S s;
    
       ss["hello"] = s;
    }
    
    struct S {
       void opAssign(int i) {
       }
    }
Nov 07 2011
parent reply Richard Webb <webby beardmouse.org.uk> writes:
On 07/11/2011 20:27, Jesse Phillips wrote:
 Came across this when trying to get Juno to work. Is there a good workaround
for it?

 http://d.puremagic.com/issues/show_bug.cgi?id=6906

 test.d(6): Error: function test.S.opAssign (int i) is not callable using
argument types (S)

      void main() {
         S[string] ss;
         S s;

         ss["hello"] = s;
      }

      struct S {
         void opAssign(int i) {
         }
      }
I have a recollection that i replaced an opAssign with a custom assign function when getting Juno to build with D2 a while ago because of something like this (was in the MethodProxy struct in com.client). That did hit a different DMD bug at the time as well though. Not ideal, but it got it working at least.
Nov 07 2011
parent reply Jesse Phillips <jessekphillips+d gmail.com> writes:
On Mon, 07 Nov 2011 20:59:05 +0000, Richard Webb wrote:

 I have a recollection that i replaced an opAssign with a custom assign
 function when getting Juno to build with D2 a while ago because of
 something like this (was in the MethodProxy struct in com.client). That
 did hit a different DMD bug at the time as well though.
 
 Not ideal, but it got it working at least.
Saw your post about the same question when digging through the Juno forms. Yep it is the exact same one. Hopefully GitHub facilitates more interest in contributing. It definitely makes it easier.
Nov 07 2011
parent Richard Webb <webby beardmouse.org.uk> writes:
I just looked at my local Juno source, and it does have the change that i
mentioned in that forum post. I just added an extra version of opAssign:

  void opAssign(R)(R dg) if (is (R : MethodProxy) )
  {
    method = dg.method;
    returnType = dg.returnType;
    paramTypes = dg.paramTypes;
  }

I forgot about that ;-)
Nov 08 2011