Forum: IronRuby Code Review: re

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Aea6cfe04952626ab630bde47ff82f89?d=identicon&s=25 Shri Borde (Guest)
on 2009-02-23 19:36
(Received via mailing list)
Attachment: re.diff (90 KB)
tfpt review "/shelveset:re;REDMOND\sborde"

  Comment  :
  Regexp literal support for /o.
  /foo/ should compare equal with /foo/o, so we ensure that
RubyRegexpOptions.Once is passed into the RubyOps runtime helper, but we
then remove it in the RubyRegex constructor
  Caching of the RubyRegex (and the underlying
System.Text.RegularExpressions.Regex) for regexp literals so that the
expression is processed only once
  Sort the method names in the generated ReflectionCache. This will make
reduce the chances of conflicts during merging. Currently, the order is
whatever System.Reflection choses.
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-02-23 20:17
(Received via mailing list)
ReflectionCacheGenerator: More concise way how to sort an array:

var methods = ReflectMethods(typeof(RubyOps)).Values;
Array.Sort(methods, (m1, m2) => m1.Name.CompareTo(m2.Name));

ScringConstructor:

I would prefer TransformConcatenation to take 2 parameters (Expr
regexOptions, Expr regexCache) rather than params array.

Then this would not be necessary:
                    List<MSA.Expression> allArgs = new
List<MSA.Expression>(2 + additionalArgs.Length);
                    allArgs.Add(paramArray);
                    allArgs.Add(codePage);
                    allArgs.AddRange(additionalArgs);

and we could do just:
        if (regexOptions != null)
                      opFactory("N").OpCall(paramArray, codePage,
regexOptions, regexCache) : ...

Other than that looks good.

Tomas
Aea6cfe04952626ab630bde47ff82f89?d=identicon&s=25 Shri Borde (Guest)
on 2009-02-23 22:03
(Received via mailing list)
Array.Sort(methods, ...) does not work because methods is an
IEnumerable, not IList, and so I have to create an auxiliary list. I did
use the inline lambda for the comparision delegate. Changed
TransformConcatenation too.

Thanks,
Shri
This topic is locked and can not be replied to.