I've got maybe the beginnings of a workaround. 
    
    
    type
      constint {.importc: "const int".} = int
      Foo = object
        a: constint
        b: int
    
    
    let bar = Foo(a:5,b:7)
    #this worked for me, annoyingly. So I'm not reproducing properly
    
    echo bar
    var baz:Foo
    #baz = bar #c error: assignment of readonly variable
    copyMem(baz.unsafeaddr,bar.unsafeaddr,sizeof(Foo))
    echo baz
    var qux = Foo(a:6,b:8)
    echo qux
    baz.b=9
    echo baz
    
    
    Run

This much works on play.nim-lang.org However, as soon as I tried overloading 
    
    
    =
    
    Run

to hide that ugly copyMem, everything immediately broke, unable to compile for 
the same reasons as you describe

Reply via email to