From: Roman Hausner Date: 2006-07-29T00:14:22+09:00 Subject: Re: Slow regular expressions :( Alexandru E. Ungur wrote: >>>> sender: "Michael W. Ryder" date: "Fri, Jul 28, 2006 at 07:30:11PM +0900" <<> What's wrong with people wanting to improve a language? > Nothing. In this case however we are not talking about improving, > but about making the regexp engine to be more forgiving, so that > we can be less careful when crafting a regex. > I wouldn't prefer Ruby to think for me, and I very much like when > it says: " - You moron, look what you did: I'm gonna stay stuck on > this regex for 56783.99 years, and all because of you!! Can you > even wait that long?!?" so that slowly I become less of a moron... > I would definitely not like it to say: " - All is good, feed me crap, > I can take it. I have a good stomach.", and let me go away with it. > But maybe that's just me... First, you are misunderstanding the extend of the problem if you think this is just about RegExps that are not "carefully crafted". As I have pointed out, with very complex expressions or expressions that get constructed automatically (which happens quite often) it is nearly impossible to avoid this, even if you are en expert with RegExps. Why would you prefer an expression engine that stupidly does *the wrong* thing? Second, the whole purpose of programming languages is to think for humans when the kind of thinking required is not actually helping to solve a problem but rather a technicality. Your argument would prevent optimizing compilers and a lot of other things where indeed a language (or its compiler/interpreter is doing a lot of thinking for humans). We are talking about Ruby here - a high level language with a design that makes it easy to learn and use. Not assmebler or C. Lastly, what you want Ruby to do here is even *more* out of the scope of a RegExp engine than simply using optimization tricks for speeding up some pathological cases: if you want it to *tell you in advance* that it is going to get into exponentional processing for a certain case you are wishing for the impossible. And if you want it to *teach* you how to make better epxressions you are asking for something nearly as complicated. -- Posted via http://www.ruby-forum.com/.