Re: [Vala] casting out parameters
- From: Jürg Billeter <j bitron ch>
- To: pancake <pancake youterm com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] casting out parameters
- Date: Wed, 26 May 2010 19:28:09 +0200
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]