[Vala] Genie does not allow foreach methods, patch included



There is an issue in Genie trying to invoke any method named foreach.

foreach is a keyword in vala to iterate over sequences.

But, Genie uses the more pythonic approach of using the for keyword:
  for item in container do ....

foreach is not a keyword in Genie, and it has no usage.

However, Genie reserves the word in the parser, and when any method
called for each is invoked, an error occur. For example:

$ cat test.gs
def f(taglist: Gst.TagList, tag_name: string)
        return
init
        var L = new Gst.TagList()
        L.foreach(f)

$ valac test.gs --pkg gstreamer-0.10
test.gs:7.11-7.17: error: syntax error, expected identifier
        L.foreach(f)


And the same happen for any method named foreach.

I already raised a bug:
https://bugzilla.gnome.org/show_bug.cgi?id=607884

With a patch to remove foreach from the genie parser:
https://bugzilla.gnome.org/attachment.cgi?id=152102

Because of this issue, Genie can't practically use containers
like GstTagList, HashTable, Datalist and so on.



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