On Wed, 2008-04-09 at 16:20 -0400, Michel Salim wrote:
On Tue, Apr 8, 2008 at 1:07 PM, Jürg Billeter [EMAIL PROTECTED] wrote:
Short example:
public void foo (Bar bar) {
// bar is expected to be non-null
// will be enforced at run-time in future Vala versions
}
public void foo (Bar? bar) {
// bar is allowed to be null
}
Any questions or comments about this?
Presumably a compile-time check is also performed on return values? e.g.
public Bar foo () {
return null;
}
should fail.
Yes, that will be the case.
What if the nullity of the value cannot be determined at compile time?
Enforce that the return type must have '?' ?
The compiler will report a warning. If you're sure that it'll always be
non-null, you can add an explicit cast or assert to avoid the warning.
We'll only enable the warnings by default when we have a sensible
non-null analysis and we'll probably also add an option to disable the
warnings.
Jürg
___
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list