Code Review: Various5

tfpt review /shelveset:Various5;REDMOND\tomat

Reviewed F2F by Dino and John.

  •      Implements $KCODE global variable.
    
  •      Implements ToString() and ToByteArray() methods on 
    

MutableString - they create a copy of the content converted to
System.String or byte[] preserving the content representation.

  •      Fixes bug #19309: double should be parsed using an invariant 
    

culture

  •      Fixes bug #19867: $0 and $: not initialized correctly - 
    

initializes $0.

  •      Fixes bug #15982: re-opening the class "Class" need 
    

update version?

  •     Incorrect tests were emitted when dispatching on 
    

modules/classes

  •      Makes method dispatch multi-runtime safe (the missing check 
    

caused sharing of the rule across runtimes)

  •      Improves and fixes bugs in MutableString construction from 
    

literals and by concatenation of embedded expressions (“foo #{x} bar”):

  •     to_s string conversion protocol needs to be applied
    
  •     "#{x}" was broken - to_s wasn't called on x
    
  •     Optimizes concatenation:
    
  •     Where possible the compiler performs the concatenation (like x 
    

= “foo” “bar”).

  •     Special-cases concatenation helpers for all combinations of at 
    

most two literal and variable arguments.

  •     Some more optimizations are still possible.
    
  •      Implements Regex#to_s, Regex#inspect, Regex#options
    
  •     Fixes bug #19756: Regular expression substitution
    
  •      Changes instantiation of Ruby classes defined in libraries
    
  •     C.new doesn't invoke "initialize" method anymore if C is a 
    

library class.

  •     "initialize" can therefore be invoked only via send, from 
    

subclasses (directly or using super) and when instantiating a subclass
that has no “initialize” method. In these cases the call is
reinitializing an existing object.

  •      Fixes one of the Array#initialize overloads
    
  •     This didn't work previously: Array.new(class C; def to_int; 5; 
    

end; self; end.new) { ‘foo’ }

  •      Implements parameterless Proc#new
    
  •     This overload searches the lexical scope chain for a method 
    

scope and picks its block parameter.

  •      Fixes #19805: Wrong number of type of arguments for Class
    
  •     Implements Class constructor that creates an anonymous class
    
  •      Fixes #19953: class_eval adds methods to the wrong class
    
  •      Fixes EqualityComparer: it shouldn't call 'eql?' if the 
    

values being compared are reference-equal.

  •      Refactors Struct#new and fixes some issues there.
    
  •      Fixes some specs.
    

Tomas