Hello,
On Thu, May 13, 2010 16:06, Alexander Semenov wrote:
> I'm looking at Vala GIO samples here:
> http://live.gnome.org/Vala/GIOSamples
>
> Don't you think that null-check like
>
> var files = yield e.next_files_async (10, Priority.DEFAULT, null);
> if (files == null) {
> break;
> }
>
> is redundant in "Asynchronous File Listing"
No, because null is how empty list is implemented.
> example since the
> "next_files_async" method signature is:
>
> public virtual async List<FileInfo> next_files_async (int num_files, int
> io_priority, Cancellable? cancellable)
Non-nullable GLib.List makes no sense, because that would mean it may
never be empty.
GLib.List is somewhat tricky, because it does not represent the collection
as a whole, but rather an iterator to it and the collection does not have
any representation as a whole at all. So to represent nothing, null is all
that is left.
> ? Actually when --enable-experimental-non-null option is used it will
> not compile - the return value isn't nullable and cannot be compared to
> null.
Than that's a bug in the vapi.
--
- Jan Hudec <[email protected]>
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list