Re: [Vala] Abstract properties in Concrete Class
On Wed, Jun 09, 2010 at 10:25:37PM -0400, tecywiz121 wrote: Hello again, This is the second snippet I was curious about. Basically, valac should not allow the following code to compile since IMHO, its completely wrong. Just checking whether I should file a bug report or not. public class TestClass { public abstract bool test_prop { get; set; } } public static int main(string[] args) { TestClass tc = new TestClass(); bool test = tc.test_prop; stdout.printf(%s\n, test ? TRUE : FALSE); return 0; } Given class TestSubclass : TestClass overriding test_prop: TestClass tc = new TestSubclass(); bool test = tc.test_prop; It's completely right. You might want to make TestClass an abstract class to not instantiate it, but problems come on runtime and it's not a compiler failure if you don't override the property. -- http://www.debian.org - The Universal Operating System signature.asc Description: Digital signature ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Abstract properties in Concrete Class
Offtopic: why don't you use? print (test.to_string()); On Jun 10, 2010, at 9:08 AM, Luca Bruno lethalma...@gmail.com wrote: On Wed, Jun 09, 2010 at 10:25:37PM -0400, tecywiz121 wrote: Hello again, This is the second snippet I was curious about. Basically, valac should not allow the following code to compile since IMHO, its completely wrong. Just checking whether I should file a bug report or not. public class TestClass { public abstract bool test_prop { get; set; } } public static int main(string[] args) { TestClass tc = new TestClass(); bool test = tc.test_prop; stdout.printf(%s\n, test ? TRUE : FALSE); return 0; } Given class TestSubclass : TestClass overriding test_prop: TestClass tc = new TestSubclass(); bool test = tc.test_prop; It's completely right. You might want to make TestClass an abstract class to not instantiate it, but problems come on runtime and it's not a compiler failure if you don't override the property. -- http://www.debian.org - The Universal Operating System ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Abstract properties in Concrete Class
Hi, On Wed, 2010-06-09 at 22:25 -0400, tecywiz121 wrote: This is the second snippet I was curious about. Basically, valac should not allow the following code to compile since IMHO, its completely wrong. Just checking whether I should file a bug report or not. Yes, this is a bug. valac already reports an error when declaring abstract methods in concrete classes. It should do the same with abstract properties. Jürg ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list