Re: [Vala] error on property;
- From: Yu Feng <rainwoodman gmail com>
- To: Alexey Lubimov <avl l14 ru>
- Cc: vala-list gnome org
- Subject: Re: [Vala] error on property;
- Date: Wed, 20 Aug 2008 12:33:53 -0400
Hi Alex,
Fortunately I was dealing with the same problem too.
The key is for a property, you almost always want a weak string, and
manage the string in the object. In other words, this code will be fine:
public class Info.PersonInfo {
private string fio_;
public weak string fio {
get {
fio_ = get_fio();
return fio_;
}
}
public string get_fio(){
// bluh bluh bluh
}
}
I have to doubt that the memory management model for non-ref-counted
objects in VALA has some problem. I always go into trouble to use the
managed strings (string without weak), ending up with either compilation
failure or garbage C code that do a lot of useless strdup.
Yu
On Wed, 2008-08-20 at 19:46 +0400, Alexey Lubimov wrote:
public class Info.PersonInfo {
public string f_name;
public string m_name;
public string l_name;
public string fio {get {return this.get_fio();}}
public string get_fio() {
return "%s %C. %C".printf(l_name,f_name.get_char(),m_name.get_char());
}
}
PersonInfo.vala:12.7-12.28: error: Return value transfers ownership but
method return type hasn't been declared to transfer ownership
That's wrong?
any tips?
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]