tfpt review "/shelveset:CompositeConversions3;REDMOND\tomat" DLR change (interpreter) Fixes interpretation of UnaryExpresion cast with a custom method. Ruby changes 1) Implements composite conversions and defines default composite protocol conversions. A composite conversion is basically a combination of at least 2 protocol conversions. For example, some methods convert to an integer using "to_int" if available and if not "to_i" is tried. Other methods try "to_str" first and "to_int" then or vice versa to convert to String or Fixnum. For example, File#new''s first parameter performs to_str-to_int conversion. To declare such a parameter a library function uses a parameter of type Union<T1, T2> marked by [DefaultProtocol]: public static RubyFile/*!*/ CreateFile(RubyClass/*!*/ self, [DefaultProtocol]Union<int, MutableString> descriptorOrPath, [Optional, DefaultProtocol]MutableString mode, [Optional]int permission) { if (descriptorOrPath.IsFixnum()) { ... } else { ... } } This says that default protocol for Int32 and for MutableString should be performed in the order specified by the type parameters. 2) Some methods use CastToInteger protocol. This protocol calls to_int, similarly to CastToFixnum, but the result could be both Fixnum or Bignum. This is not a composite conversion since only one conversion is called (to_int) however the type of the result could be either Int32 or BigInteger. There are also other places where we need to pass around a union of Int32 and BigInteger. IntegerValue struct serves this purpose. A default protocol for IntegerValue is CastToInteger. An example of use is Bignum#<<: [RubyMethod("<<")] public static object/*!*/ LeftShift(RubyContext/*!*/ context, BigInteger/*!*/ self, [DefaultProtocol]IntegerValue other) { return other.IsFixnum ? LeftShift(self, other.Fixnum) : LeftShift(self, other.Bignum); } 3) Refactors protocol conversion classes. 4) Fixes File#open, IO#open, IO#for_fd. Fixes String#to_i and Kernel#Integer. Tokenizer now returns whitespace tokens in verbatim mode. 5) Changes format mode in runrspec to "dotted". It doesn''t produce so much noise. Tomas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090109/48ef670d/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: CompositeConversions3.diff Type: application/octet-stream Size: 230366 bytes Desc: CompositeConversions3.diff URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090109/48ef670d/attachment-0001.obj>
Interpreter change looks good. From: Tomas Matousek Sent: Friday, January 09, 2009 4:08 PM To: IronRuby External Code Reviewers; DLR Code Reviews Cc: ironruby-core at rubyforge.org Subject: Code Review: CompositeConversions3 tfpt review "/shelveset:CompositeConversions3;REDMOND\tomat" DLR change (interpreter) Fixes interpretation of UnaryExpresion cast with a custom method. Ruby changes 1) Implements composite conversions and defines default composite protocol conversions. A composite conversion is basically a combination of at least 2 protocol conversions. For example, some methods convert to an integer using "to_int" if available and if not "to_i" is tried. Other methods try "to_str" first and "to_int" then or vice versa to convert to String or Fixnum. For example, File#new''s first parameter performs to_str-to_int conversion. To declare such a parameter a library function uses a parameter of type Union<T1, T2> marked by [DefaultProtocol]: public static RubyFile/*!*/ CreateFile(RubyClass/*!*/ self, [DefaultProtocol]Union<int, MutableString> descriptorOrPath, [Optional, DefaultProtocol]MutableString mode, [Optional]int permission) { if (descriptorOrPath.IsFixnum()) { ... } else { ... } } This says that default protocol for Int32 and for MutableString should be performed in the order specified by the type parameters. 2) Some methods use CastToInteger protocol. This protocol calls to_int, similarly to CastToFixnum, but the result could be both Fixnum or Bignum. This is not a composite conversion since only one conversion is called (to_int) however the type of the result could be either Int32 or BigInteger. There are also other places where we need to pass around a union of Int32 and BigInteger. IntegerValue struct serves this purpose. A default protocol for IntegerValue is CastToInteger. An example of use is Bignum#<<: [RubyMethod("<<")] public static object/*!*/ LeftShift(RubyContext/*!*/ context, BigInteger/*!*/ self, [DefaultProtocol]IntegerValue other) { return other.IsFixnum ? LeftShift(self, other.Fixnum) : LeftShift(self, other.Bignum); } 3) Refactors protocol conversion classes. 4) Fixes File#open, IO#open, IO#for_fd. Fixes String#to_i and Kernel#Integer. Tokenizer now returns whitespace tokens in verbatim mode. 5) Changes format mode in runrspec to "dotted". It doesn''t produce so much noise. Tomas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090109/e050444d/attachment.html>
Outer ring looks good. From: Tomas Matousek Sent: Friday, January 09, 2009 4:08 PM To: IronRuby External Code Reviewers; DLR Code Reviews Cc: ironruby-core at rubyforge.org Subject: Code Review: CompositeConversions3 tfpt review "/shelveset:CompositeConversions3;REDMOND\tomat" DLR change (interpreter) Fixes interpretation of UnaryExpresion cast with a custom method. Ruby changes 1) Implements composite conversions and defines default composite protocol conversions. A composite conversion is basically a combination of at least 2 protocol conversions. For example, some methods convert to an integer using "to_int" if available and if not "to_i" is tried. Other methods try "to_str" first and "to_int" then or vice versa to convert to String or Fixnum. For example, File#new''s first parameter performs to_str-to_int conversion. To declare such a parameter a library function uses a parameter of type Union<T1, T2> marked by [DefaultProtocol]: public static RubyFile/*!*/ CreateFile(RubyClass/*!*/ self, [DefaultProtocol]Union<int, MutableString> descriptorOrPath, [Optional, DefaultProtocol]MutableString mode, [Optional]int permission) { if (descriptorOrPath.IsFixnum()) { ... } else { ... } } This says that default protocol for Int32 and for MutableString should be performed in the order specified by the type parameters. 2) Some methods use CastToInteger protocol. This protocol calls to_int, similarly to CastToFixnum, but the result could be both Fixnum or Bignum. This is not a composite conversion since only one conversion is called (to_int) however the type of the result could be either Int32 or BigInteger. There are also other places where we need to pass around a union of Int32 and BigInteger. IntegerValue struct serves this purpose. A default protocol for IntegerValue is CastToInteger. An example of use is Bignum#<<: [RubyMethod("<<")] public static object/*!*/ LeftShift(RubyContext/*!*/ context, BigInteger/*!*/ self, [DefaultProtocol]IntegerValue other) { return other.IsFixnum ? LeftShift(self, other.Fixnum) : LeftShift(self, other.Bignum); } 3) Refactors protocol conversion classes. 4) Fixes File#open, IO#open, IO#for_fd. Fixes String#to_i and Kernel#Integer. Tokenizer now returns whitespace tokens in verbatim mode. 5) Changes format mode in runrspec to "dotted". It doesn''t produce so much noise. Tomas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090109/827fc6d0/attachment-0001.html>
Ruby changes look good. From: Tomas Matousek Sent: Friday, January 09, 2009 4:08 PM To: IronRuby External Code Reviewers; DLR Code Reviews Cc: ironruby-core at rubyforge.org Subject: Code Review: CompositeConversions3 tfpt review "/shelveset:CompositeConversions3;REDMOND\tomat" DLR change (interpreter) Fixes interpretation of UnaryExpresion cast with a custom method. Ruby changes 1) Implements composite conversions and defines default composite protocol conversions. A composite conversion is basically a combination of at least 2 protocol conversions. For example, some methods convert to an integer using "to_int" if available and if not "to_i" is tried. Other methods try "to_str" first and "to_int" then or vice versa to convert to String or Fixnum. For example, File#new''s first parameter performs to_str-to_int conversion. To declare such a parameter a library function uses a parameter of type Union<T1, T2> marked by [DefaultProtocol]: public static RubyFile/*!*/ CreateFile(RubyClass/*!*/ self, [DefaultProtocol]Union<int, MutableString> descriptorOrPath, [Optional, DefaultProtocol]MutableString mode, [Optional]int permission) { if (descriptorOrPath.IsFixnum()) { ... } else { ... } } This says that default protocol for Int32 and for MutableString should be performed in the order specified by the type parameters. 2) Some methods use CastToInteger protocol. This protocol calls to_int, similarly to CastToFixnum, but the result could be both Fixnum or Bignum. This is not a composite conversion since only one conversion is called (to_int) however the type of the result could be either Int32 or BigInteger. There are also other places where we need to pass around a union of Int32 and BigInteger. IntegerValue struct serves this purpose. A default protocol for IntegerValue is CastToInteger. An example of use is Bignum#<<: [RubyMethod("<<")] public static object/*!*/ LeftShift(RubyContext/*!*/ context, BigInteger/*!*/ self, [DefaultProtocol]IntegerValue other) { return other.IsFixnum ? LeftShift(self, other.Fixnum) : LeftShift(self, other.Bignum); } 3) Refactors protocol conversion classes. 4) Fixes File#open, IO#open, IO#for_fd. Fixes String#to_i and Kernel#Integer. Tokenizer now returns whitespace tokens in verbatim mode. 5) Changes format mode in runrspec to "dotted". It doesn''t produce so much noise. Tomas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090112/21783814/attachment-0001.html>