Re: [Vala] casting out parameters
- From: pancake <pancake youterm com>
- To: Jürg Billeter <j bitron ch>
- Cc: "vala-list gnome org" <vala-list gnome org>
- Subject: Re: [Vala] casting out parameters
- Date: Wed, 26 May 2010 22:50:51 +0200
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` does not
guarantee that `foo` is set to an instance of `Bar`. The method could
also be implemented as follows:
void test(out Foo foo) {
foo = new Foo ();
}
If the compiler accepted your `main` method, you'd have a variable of
type Bar pointing to an object of type Foo, and this should never
happen. The compile error you get is intentional and not a bug.
Jürg
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]