Re: [Vala] Starting with Vala, problems with strings



In my test code i want to split a math sentence in terms, like the
next string example:
"(2+a)*d+(a*b-3)-4-q/2"

My function split_in_terms, is a very bad implementation (i know) that
should split the string into 4 terms, and if not possible, return
NULL.
For that i have tryed with a List, but when using nth_data it prints
this string: "g_list_nth_data", only once. So i think that Lists are
not yet fully implemented so i switched to Array.
Where now i cant compile it.
ERROR:arraylist.c:322:gee_array_list_real_get: assertion failed: (_tmp0)

And i dont have any clue where the problem is.

I find that the Gee collections are the nicest to use with Vala. (See
attachment.)
http://live.gnome.org/Vala/Tutorial#head-2eb5f4c78cb61f38bd03db07f37abf55a9ec4c07

Also i dont know when should i use pointers in Vala.
I know from C that every object must be defined as a pointer, but the
Vala bindings, doesnt defines them as pointer, so, why should i add an
*

Pointers should probably be avoided whenever possible.
http://live.gnome.org/Vala/Tutorial#head-8712c308df0fc07f772bb1f8011373900d8a46ac

If i dont add it, i cant change the value of the parameter.
supouse a function like next:
private static void split_in_terms(string strmath, string* term_left,
string* term_right)
This also gives a lot of warnings  for term_left and right.

Vala supports the modifiers "out" and "ref" for passing arguments by reference.
http://live.gnome.org/Vala/Tutorial#head-64f47493a7181152df5d9db98a2f998ef6147163

-- 
http://homes.eff.org/~barlow/EconomyOfIdeas.html
http://www.dreamsongs.com/MobSoftware.html
http://www.gnu.org/philosophy/shouldbefree.html

Attachment: blah.vala
Description: Text Data



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