[Vala] About regular expressions and pattern matching



Hi,

Thanks for a great language! I was wondering if you have plans to add first class regular expressions? They should be relatively simple to implement since the libs are there in Glib but they would make code much easier to read compared to calling functions. Replacements based on regular expressions could also be there like in Perl (and others).

It would also be nice to have pattern matching that goes beyond simple switch statement by allowing matching strings with reg exps (and other types like floating point numbers with values or value ranges etc. as well) like:

 match (s) {
 on ( /(\d+)?\.\d+/ || /\.\d+/ ) { /* do float stuff */ }
 on ( /\d+/ ) { /* do int stuff, no break needed at the end of block */ }
 default { /* error */ }
 }

Anyway these if..then..elsif... control structures are so common that it would make code to look cleaner if there is support for them in the language.

Regards,
J-P


__
Wippies-vallankumous on täällä! Varmista paikkasi vallankumouksen eturintamassa ja liity Wippiesiin heti!
http://www.wippies.com/




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