Vala: Gotchas, Tips and Tricks

后端 未结 9 1666
情书的邮戳
情书的邮戳 2021-01-30 13:04

As a programmer who is new to Vala, what is your number one piece of advice to someone who is new to the language?

相关标签:
9条回答
  • 2021-01-30 13:42

    Generally, Vala is excellent, but the one big gotcha I've found is that either its handling of arrays is very primitive compared to the rest of the language or its documentation has a very gaping hole in it.

    Despite a long, hard look through the documentation, tutorials, and Google, I've concluded that:

    • The only way to concatenate two arrays is either to fall back to C-style tricks or use foreach and += to manually add one array to the other element-by-element.
    • You can do a slice like argv[1:-1] but there seems to be no syntax for equivalent to Python's argv[1:], so you have to fall back to something more procedural for that.
    • Libgee is useless to me because, while Gee objects have methods like add_all, none of them take C-style arrays, so I'm back to using add with foreach and +=.
    0 讨论(0)
  • 2021-01-30 13:44
    1. For multiple resources, this will be a general resource for a bit: Vala - GNOME Live!.
    2. To get up close and personal with GObject: GObject Reference Manual.
    3. I don't know what background you're coming from, but you will find this helpful: Vala Quick Intro for C# Programmers

    In any event, knowledge of C will be of great use. Our team is actually considering a progressive revamp and porting to Vala. We have members with strong backgrounds in C#/C++ and this change in direction (over time) will be beneficial to the performance and flexibility of our products.

    0 讨论(0)
  • 2021-01-30 13:45

    my advice would be to read the documentation but i personally learned the language by looking at vala code examples:

    The official vala tutorial

    some documentation

    the vala tutorial helped me alot and the documentation page contains alot of useful examples but the one site that helped me most was and still is valadoc.org:

    valadoc.org

    valadoc will help you alot with the different classes and functions also other librarys.

    vala is very c# alike but you will often see java like interfaces too. any experince with C is good because all the librarys around vala is written in C and when calling functions you can almost see all the C code that is right under the surface.

    for those people that say vala is too young: vala will continue to bee as young as it is now until somebody makes a VERY big documentation or starts a project as big as QT where thousands of people ask questions everyday.

    vala is a little hard to learn in the start because of the bad documentation but don't give up! it's a great language when you have learned it's basics. good luck! and sorry for the bad english :)

    0 讨论(0)
提交回复
热议问题