[Vala] Proposal: CCodeFunc modifier or alike?



Dear developer,


The CCode series of modifier are good. But 

(1) do we really need to make it so abstract? 
(2) the array problem is not easy to solve.
and such.

I suggest a new way to specific the way vala mangles the member
functions?

CCodeFunc = cname(paralist);
where cname is the c function's name, and

paralist ::= this | formal param | static members

Several examples to show the flexibility:

class List<weak G> {
        [CCodeFunc this = g_list_insert(this, data)]
        public void insert(G data);
        [CCodeFunc this = g_list_remove(this, data)]
        public void remove(G data);
        [CCodeFunc g_list_free(list)]
        public static void DestroyFunc(List<weak G> list);
}
class List<G> {
        [CCodeFunc this = g_list_insert(this, data)) ]
        public void insert(G #data);
        [CCodeFunc (this = g_list_remove(this, data); G.DestroyFunc(data)) ]
        public void remove(G data);
        [CCodeFunc (g_list_foreach(list, G.DestroyFunc);g_list_free(list))]
        public static void DestroyFunc(List<G> list);
}

It will allow us to pull out a lot of mess from the vala compiler to the
vapi files.

How do you think about the idea ?

Yu






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