* Todd Holloway (todd / duckland.org) wrote: > Larry Wall is redesigning regular expressions, in his latest > "Apocalypse 5". http://www.perl.com/pub/a/2002/06/04/apo5.html Read it, came out with a headache :) Start at page 6 if you want to see his proposed changes. > Will Ruby be taking a similar change? I'm no expert at regexes, but if > it can make then easier to read/write, sounds like a good idea. Unfortunately, Larry seems to be putting quite a bit of effort into embedding Perl directly into the regexp system with expressions like: /(\d+) { $1 < 582 or fail }/ /(.*) { print .pos }/ / (\S*) { let $x = .pos } \s* foo / / @x := [ (\S+) (\s*) ]* / / <@rule_from_array> <%rule_from_hash> <&rule_from_sub()> / These sorts of expressions litter A5, and I think will make other languages adopting them quite painful. I'm not conviced by his other changes; pushing most common things into the shortest possible set of characters is a very Perlish desire, and in making such changes everyone's going to have to re-learn their syntax and how they write regexp while keeping the old stuff around for pretty much every other tool in existance. I can see lots of people looking at the new-style Perl expressions and wasting time thinking "Uh?" before they remember [..] is not a character class anymore, and that . really is matching everything, and that whitespace needs to be escaped, and... > But is it worth breaking quite a bit of previously written code? No. Larry wants to do this now because he's breaking everything anyway; unless Rite contains a similar amount of breakage I wouldn't like to see our regexp engine copy Perl 6. Even then, I'm not convinced it's a good idea to blindly follow them. Pages 2-5 do contain some useful discussion regarding the shortcomings of current regexp stuff, and I'd be happy to be able to c&p regexps from Perl 6 that don't embed Perl (as I'm sure most won't, despite what Larry seems to want), but I'd want to do it using UberRegexp.new or some alternative foo// syntax or something. Ideally I'd like to see something like this come from many different places; if Ruby, Python, Java, etc can come up with a mutually inclusive matching/parsing system like Perl 6 without falling into the "Gee Wizz, I can put Perl in this and make it even more unreadable!" trap we're much more likely to get somewhere productive. > Ruby may have a big advantage in that it's code base is quite a bit > smaller. Well, there's no code to worry about yet; Perl 6 is, um, ages away, so there's no reason to panic. We may even find Perl 6 flops as it's users discover it's easier just to switch to Python/Ruby/Java/Cobol/Assm than learn all the stuff that's changing (*grin*). -- Thomas 'Freaky' Hurst - freaky / aagh.net - http://www.aagh.net/ - Critic, n.: A person who boasts himself hard to please because nobody tries to please him. -- Ambrose Bierce, "The Devil's Dictionary"