[Vala] Is there an Any type in vala?



The need for an 'Any' type emerges in the following context:


Object o = new Object();
Object o1 = new Object();
string s = "string"
o.set_data("data", o1);
o.set_data("string", s);

set_data is currently declared as 
set_data(string, void *);

This will break the auto memory management of vala, making it completely
impossible to pass a string into set_data.
The only work around is to provide a new member function in string
class string {
[CCode (name = "g_strdup")]
weak string dup_and_give();

}
to create a copy of the string, and immediately give the ownership to
set_data.

Maybe I should file a new Bug?


Yu






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