Re: [Vala] naming issue with abstract async functions



On Thu, Jul 08, 2010 at 18:41:40 +0200, JM wrote:
Hello

I have the following programm:

public abstract class AbcAbstr : GLib.Object {
  public abstract async void test_async();
}

public class ABC : AbcAbstr {
  public override async void test_async() {
    print("test2\n");
  }

  public static void main() {
    var abc = new ABC();
    abc.test_async();
    new GLib.MainLoop().run();
  }
}

The compilation leads to the following problem:

/home/me/Desktop/testasync.vala.c: In function
‘abc_abstr_test_async_finish’:
/home/me/Desktop/testasync.vala.c:93: error: ‘AbcAbstrClass’ has no
member named ‘test_async_finish’
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)


If I change the function name from "test_async" to "test_asyn" it
works. 
Is that a bug or is this something that is coming from a design towards
the usage with gio's functions? 

I believe it is a bug in the name mangling. An async function is really
three functions -- the start function that initiates the operation, finish
function that retrieves the result and the callback that does the real work.

The name of start function is the same non-async function would get and the
finish function has '_finish' appended. However, if the function name ends
with '_async', it is stripped first (to follow GLib convention). It seems
this stripping is not done consistently when overriding abstract or virtual
async methods. It looks like a bug in vala.

-- 
                                                 Jan 'Bulb' Hudec <bulb ucw cz>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]