[Vala] [Bug?] Access to non-static field are permitted inside static methods

2011-11-26 Thread Tal Hadad
I've noticed now after finding a bug in my program, that access to non-static field are permitted inside static methods! I didn't believed no one was noticed this until now... Here is a code shows the behavior: class A { int num = 0; static void foo () { if (num == 0) num++; } } V

Re: [Vala] How to cast Gdk.EventKey to Gdk.Event ?

2011-11-26 Thread Peng Huang
It works. Thanks. But I found another problem. The vala will make a copy of GdkEventKey everytime, when I access a field of struct GdkEventKey. I think it is not efficient. How to avoid it? Is it a bug in vala? I have some code like: uint keyval = e.keyval; // e is Gdk.EventKey; uint state = e.

Re: [Vala] How to cast Gdk.EventKey to Gdk.Event ?

2011-11-26 Thread Tal Hadad
Gdk.Event* real_e = (Gdk.Event*)(&e); It's tested. Gdk.Event* is an unowned Gdk.Event, only different is syntax: (Gdk.Event)instance = (Gdk.Event*)->instance Tal Date: Fri, 25 Nov 2011 23:48:59 -0500 From: shawn.p.hu...@gmail.com To: vala-list@gnome.org Subject: [Vala] How to cast Gdk.EventKey

Re: [Vala] Re-entrant/Nested Iterator..

2011-11-26 Thread Shawn Ferris
On Fri, Nov 25, 2011 at 9:31 PM, Shawn Ferris wrote: > ..snip.. > class Query { >  class Iterator { >    next() { >      .. step over query .. >      if (Sqlite.DONE) return false; >      if ( record.linked_child != null ) { >        child = new Query(record.linked_child); >        nested = true;