Re: [Vala] casting out parameters

2010-05-28 Thread pancake
Yeah that would be good to have. Jurg? What do you think about it? You will do in one line what we can now do with 3 and its easier to read. I was also wondering the support for casting lambda/closure arguments like: Foo.connect ((myclass*)x,(mytype)y) = { }); - Original message

Re: [Vala] casting out parameters

2010-05-27 Thread pancake
And if it's a subclass? Which is what 'as' does. - Original message - On Wed, 2010-05-26 at 15:41 +0200, pancake wrote: Would love to see this dynamic casting supported by the language.. Should I open a bug? As Nor Jaidi Tuah wrote, the declaration of the method `test` does not

Re: [Vala] casting out parameters

2010-05-27 Thread Nor Jaidi Tuah
On Wed, 2010-05-26 at 20:23 +0200, pancake wrote: And if it's a subclass? Which is what 'as' does. 'as' is safe. If the cast is incompatible, you get null. Of course vala could have been designed to allow test(out bar as Bar) or some other syntax to tell the compiler that we know what we

Re: [Vala] casting out parameters

2010-05-26 Thread pancake
Would love to see this dynamic casting supported by the language.. Should I open a bug? - Original message - On Tue, 2010-05-25 at 11:12 +0200, pancake wrote: How can I cast an out parameter? public class Foo {} public class Bar : Foo {} void test(out Foo foo) {       foo =

Re: [Vala] casting out parameters

2010-05-26 Thread Jürg Billeter
On Wed, 2010-05-26 at 15:41 +0200, pancake wrote: Would love to see this dynamic casting supported by the language.. Should I open a bug? As Nor Jaidi Tuah wrote, the declaration of the method `test` does not guarantee that `foo` is set to an instance of `Bar`. The method could also be

Re: [Vala] casting out parameters

2010-05-26 Thread pancake
Ok :) I got it! Thanks On May 26, 2010, at 7:28 PM, Jürg Billeter j...@bitron.ch wrote: On Wed, 2010-05-26 at 15:41 +0200, pancake wrote: Would love to see this dynamic casting supported by the language.. Should I open a bug? As Nor Jaidi Tuah wrote, the declaration of the method `test`

[Vala] casting out parameters

2010-05-25 Thread pancake
How can I cast an out parameter? public class Foo {} public class Bar : Foo {} void test(out Foo foo) { foo = new Bar (); } void main() { Bar bar; test (out bar); } a.vala:10.9-10.15: error: Argument 1: Cannot convert from `Foo' to `Bar?' ___

Re: [Vala] casting out parameters

2010-05-25 Thread Nor Jaidi Tuah
On Tue, 2010-05-25 at 11:12 +0200, pancake wrote: How can I cast an out parameter? public class Foo {} public class Bar : Foo {} void test(out Foo foo) { foo = new Bar (); } void main() { Bar bar; test (out bar); } a.vala:10.9-10.15: error: Argument 1: Cannot convert