>===== Original Message From matz / zetabits.com (Yukihiro Matsumoto) ===== >Hi, > >In message "[ruby-talk:16464] Re: Opinion sought: parsing non-regular languages" > on 01/06/14, Robert Feldt <feldt / ce.chalmers.se> writes: > >|Matz: Any plans on including (?{}) constructs in future Ruby regexp >|engines? > >It's too nasty for me. ;-) >In reality, it has several drawbacks, > > * it makes regex more complex, which already is too complex for my > brain to understand. Regular expressions are not that complex. The average regular expression can be described in several lines of a natural language. However it usually appears as part of a single line. As anyone who has studied compression knows, there is no mathematical difference between well encrypted data, highly compressed data, and white noise. Applying this principle to REs leads to the description, "Encapsulated line-noise" > * it disables regex routine from being used by something other than > Ruby. For example, namazu (full text search engine) and I18N PHP3 > uses this routine. Additionally it limits possible RE optimizations. You never know when someone has code whose behaviour depends on the order of execution that the RE engine will use. But if you eliminate some branches based on a simple preliminary pass, their code may break. If you have the feature, it should be clear that you cannot depend on it working forevermore. >I wish I could accomplish it by finding workaround. > Does anyone have a practical use for this in mind? I don't use this in Perl and I am not sure why I would want to. In fact even where Ilya pointed out that it could be useful (throwing and catching exceptions to prune possible matches) it looked so gross that I wouldn't want to do that... Cheers, Ben