Hi,

I'd like to know if this is considered to be a bug or feature:
when I pass an empty list to some function/method, it generates critical error 
- but to any Java/C#/C++/Whatever programmer this would be very confusing..
I know the reason for this as I've been working with glib for some time, but 
those without any previous glib experience may be severely confused..

In case of this being classified as a bug I humbly suggest removing 
"g_return_if_fail (list != NULL);" in generated code as NULL is valid (empty) 
GLib.List

here is an example of what I mean:
---------------------------------------
using GLib;
void print_list(List<int> list) {
    foreach (int x in list)
        stdout.printf("%d\n", x);
}
int main (string[] args) {
    var xy = new List<int>();
    print_list(xy);
    return 0;
}
----------------------------------------
valac -o list list.vala 
./list 

** (process:6750): CRITICAL **: print_list: assertion `list != NULL' failed
----------------------------------------

Thanks in advance for any reply.

Jan Spurny
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to