[Vala] A few questions



Hello,

I have recently found Vala/Genie, and I think this is a very interesting
project. Although I have learned some Java and can more or less understand
Vala, I find Genie more attractive because the syntax is much simpler and
IMHO has some similarity with Delphi, which is what I have used for my few
little programs.

Anyway, I have some doubts I would like to clear (and please forgive any
possible stupidity, I am not an experienced programmer).

As the documentation on Genie is still incomplete, I tried to do something
like this (without success):

[indent=2]
const MAXVALUE: int = 50
init
  myarray : array of int = {1..MAXVALUE}

Isn't there a similar way to declare an array using only minimum and maximum
values?

This way of using two values for declaring a range is also quite useful for
other things, like cases:

case a
  when 1..100
    print "first hundred"
  when 101..200
    print "second hundred"

But I couldn't find such a thing in the available documentation. If there is
a way, please provide an example, otherwise I would suggest to implement it.


Also, while looking for genie-related stuff, it seems you can use the
backslash to split lines (at least that's what I see in
valageniescanner.vala, starting from line 485), however I have tried using
it (with different indentations) without success. Could anyone post a
snippet of how to use it, for example to pass parameters to a function, each
in a separate line?


One last thing: is there a shuffle method for collections? I haven't been
able to find it.


Regards, Hugo

PS I placed different doubts in the same message because I didn't see any
rule to post each question separatedly when subcribing to the list. Let me
know if it is your policy to separate threads by topic.


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