Hello,

just another one try to use a property in an interface.

1. It's so unnatural that an implementation of a property must match exactly to its declaration. Though it should be a superset of the declaration (as in C#):
valac cl1.vala if1.vala
cl1.vala:3.3-3.20: error: Type and/or accessors of overriding property `NS1.Cl1.str1' do not match overridden property `NS1.I1.str1'

2. Because of the point 1, one have to write such strange things as:
        public string str1 { get; private set; }
Though it doesn't work either (i.e. valac cl1.vala if2.vala ). I hope that the patch of Alexander Bokovoy will fix that (see that letter):
Subject:        Re: [Vala] interface properties: unexistent accessor
Date:   17.11.2008 13:08:20 GMT+6

====================

What do you think about changing this in Vala - to how it woks in C#:
1. Implementation is a superset of the declaration in interface.
2. Prohibit private accessors in interfaces.

I attach a small example.

Best regards, Ildar
--
Ildar  Mulyukov,  free SW designer/programmer
================================================
email: [EMAIL PROTECTED]
home: http://tuganger.narod.ru/
ALT Linux Sisyphus
================================================
namespace NS1 {
	public class Cl1 : Object, I1 {
		public string str1 { get; private set; }
		construct {
			str1 = "aa";
		}
	}
}

void main() {
	var o = new NS1.Cl1 ();
	message( o.str1 );
}
namespace NS1 {
	public interface I1 : Object {
		public abstract string str1 { get; }
	}
}
namespace NS1 {
	public interface I1 : Object {
		public abstract string str1 { get; private set; }
	}
}
_______________________________________________
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to