Re: [Vala] Suprising behavior for Lists
- From: Jürg Billeter <j bitron ch>
- To: davve <keijser gmail com>
- Cc: vala paldo org
- Subject: Re: [Vala] Suprising behavior for Lists
- Date: Sun, 17 Dec 2006 16:32:04 +0100
Hi davve,
On Fre, 2006-12-15 at 14:31 +0100, davve wrote:
Hi there, new on the list and new to Vala.
currently I'm just playing around a bit with it. And while using lists
vala generates c-code which fails to compile.
I'm doing something like this.
using GLib;
public class test{
private List<string> _list;
public List<string> list{
get{ return _list; }
set { _list = value; }
}
public void run(){
list.append("hello");
list.append("world");
}
}
the append calls results results in lines like this
test_get_list (self) = g_list_append (test_get_list (self), g_strdup ("hello"));
which obviously doesn't work, something like this would probably make
more sense to generate.
test_set_list(self, g_list_append (test_get_list (self), g_strdup ("hello")));
Thanks for the bug report. GList methods are quite special in the way
you have to call them in C. I'd currently not recommend you to use them
in settable properties as I haven't evaluated yet how they are best
handled regarding ownership/memory management. The List methods should
work fine in non-property contexts (fields or local variables), though.
Jürg
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]