> In your case, if you use ptr or template for aliasing instead of let/var you 
> will not ...

Yes, but I can not see how this really helps.

gintro attemps to provide a simple gtk api similar to maybe Python or Ruby, so 
the user will be able to just allocate a surface and a cairo context, and then 
do the painting. (Buffered painting on custom surface in this case, plain 
painting in the draw callback is already working fine.) This is
    
    
    proc paint(this: PDA) =
      this.surf = this.darea.window.createSimilarSurface(Content.color,
          this.darea.allocatedWidth, this.darea.allocatedHeight)
      let cr = newContext(this.surf)
      cr.lineTo(myX, myY)
    
    
    
    Run

And my suggestions in my initial post works both fine...

Setting impl to nil in the macro generated code avoids a cairo_destroy() for 
sure. And the trick "type ContextXX = object of Context; var cr: ContextXX" 
avoids the =destroy call too, but I am not sure if Araq may change that later. 
I had the feeling that lent or sink annotations for local variables may also 
make a difference, but I may not really understand them, have not yet seen a 
working example code.

Reply via email to