Re: [Vala] error on property;

2008-08-20 Thread Sam Liddicott
Yu Feng wrote: On Wed, 2008-08-20 at 18:54 +0100, Sam Liddicott wrote: Yu Feng wrote: 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 fi

Re: [Vala] error on property;

2008-08-20 Thread Yu Feng
On Wed, 2008-08-20 at 18:54 +0100, Sam Liddicott wrote: > Yu Feng wrote: > > 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:

Re: [Vala] error on property;

2008-08-20 Thread Sam Liddicott
D]> Sent: 20 August 2008 18:54 To: Yu Feng <[EMAIL PROTECTED]> Cc: vala-list@gnome.org Subject: Re: [Vala] error on property; Yu Feng wrote: 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 str

Re: [Vala] error on property.

2008-08-20 Thread Alexey Lubimov
Thanks. I think, direct use function get_fio() is better. ;) Sam Liddicott пишет: properties and property getters are all weak. but you are also generating the string you return which is not weak. if the actual string value returned doesn't change, you might want to use a lazy create and have

Re: [Vala] error on property;

2008-08-20 Thread Sam Liddicott
Yu Feng wrote: 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 f

Re: [Vala] error on property.

2008-08-20 Thread Sam Liddicott
properties and property getters are all weak. but you are also generating the string you return which is not weak. if the actual string value returned doesn't change, you might want to use a lazy create and have the object "own" the string and then you can return a weak reference: private string

Re: [Vala] error on property;

2008-08-20 Thread Yu Feng
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 {

[Vala] error on property.

2008-08-20 Thread Alexey Lubimov
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: Re