Re: [Vala] Type casting



Hi Hans,

On Mon, 2008-01-21 at 14:36 +0100, Hans Vercammen wrote:
First of all, many thanks for a great initiative which has in my opinion
a very bright future!

You're welcome.

I am not quit sure on which level invalid type casts should be
monitored, whether it be the vala compiler or the underlaying gobject.
Please view the attached test-case for details.

The attached samples look fine, however, I have to add some comments
regarding non-null types.

        /* Silently accept null cast ? */
        foobar = null;

This will raise an error when non-null types have been implemented. The
non-null type support is currently only enabled when you pass
--enable-non-null to valac. We intend to enable this by default in the
future. foobar needs to be declared as nullable type, i.e. `FooBar?´ to
allow null assignment.

        /* Nullexception */
        foo.data = 5;

If foo has been declared as a nullable type, this will raise an error
(or warning) at compile-time in future versions, when non-null types are
enabled.

Jürg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]