Re: [Vala] About regular expressions and pattern matching



Use Ruby, Luke ;)

On Wed, 2008-04-16 at 12:02 -0400, Levi Bard wrote:
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).

 I'm not sure whether this would really make code easier to read, it can
 also have the opposite effect for people that don't know the syntax.
 Anyway, we don't intend to extend the current syntax substantially in
 the 0.3.x release cycle. We should discuss this after 1.0.

I agree that it would be convenient to have regex as a first-class data type.
I don't think that:
/(\d+)?\.\d+/ || /\.\d+/.match(inputStr)

is less readable than:
new Regex("/(\d+)?\.\d+/ || /\.\d+/").match(inputStr)

, and some integration with language constructs like loops and switch
statements would be fantastic.  After 1.0, of course. ;-)





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