/o regexp modifier (Ruby compatibility)
---------------------------------------

                 Key: JRUBY-1552
                 URL: http://jira.codehaus.org/browse/JRUBY-1552
             Project: JRuby
          Issue Type: Bug
          Components: Compiler, Core Classes/Modules, Parser
    Affects Versions: JRuby 1.1b1
         Environment: Anywhere
            Reporter: Kornelius Kalnbach


Ruby regular expressions provide a /o option with the following meaning (from 
Pickaxe, forgive me):

o - Substitute Once.
Any #... substitutions in a particular regular expression literal will be 
performed just once, the first time it is evaluated. Otherwise, the 
substitutions will be performed every time the literal generates a Regexp 
object.

JRuby currently ignores the modifier, which results in lower performance when a 
library is counting on the feature. For example, CodeRay 
(http://coderay.rubyforge.org/) uses it heavily, and runs about 10,000 times 
slower with jruby 1.1b1.

Testing the feature is simple:

{{assert Array('a'..'z').map { |c| c.to_s[/#{c}/o] }.compact.size == 1}}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to