Looks good! -----Original Message----- From: Tomas Matousek Sent: Thursday, May 21, 2009 2:50 PM To: IronRuby External Code Reviewers; Rowan Code Reviewers Cc: ironruby-core at rubyforge.org Subject: Code Review: Protected3 tfpt review "/shelveset:Protected3;REDMOND\tomat" Small changes in DLR. Ruby: Fixes handling of CLR protected and private methods and properties. Enables generic methods in ClsTypeEmitter. Removes RubyCallFlag.TryCall - it''s not used anymore. Notes on visibility: Ruby visibility is orthogonal to CLR visibility. Ruby visibility is mutable (can be changed using Kernel#public/private/protected methods), CLR visibility is not. A CLR method group can comprise of methods of different CLR visibility. Ruby visibility applies on the group as a whole. Ruby-protected members can only be called from a scope whose self immediate class is a descendant of the method owner. CLR-protected members can only be called if the receiver is a descendant of the method owner. Ruby-private members can only be called with an implicit receiver (self). CLR-private members can only be called in PrivateBinding mode (-X:PrivateBinding command line option), the receiver might be explicit or implicit. Tests: Since protected methods can only be called on a derived class instance the specs need to be adjusted accordingly. I''ve fixed generic_spec nad overload_spec and commented out a block in protected_spec - all the cases there need to be changed to negative cases (all should fail). Removed ROWAN_BIN check in External.LCA_RESTRICTED\Languages\IronRuby\mspec\default.mspec so that mspec picks up IR_OPTIONS even if ROWAN_BIN is not set. Tomas
For the protected tests, can you add specs that test that the protected .NET
methods are callable from an instance_eval?
@klass.instance_eval {public_protected_overload("abc")}.should
equal_clr_string("protected overload")
Don''t worry about protected_spec though, I''ll fix that.
Other than that, test looks good.
JD
...there is no try
> -----Original Message-----
> From: Curt Hagenlocher
> Sent: Thursday, May 21, 2009 3:08 PM
> To: Tomas Matousek; IronRuby External Code Reviewers; Rowan Code
> Reviewers
> Cc: ironruby-core at rubyforge.org
> Subject: RE: Code Review: Protected3
>
> Looks good!
>
> -----Original Message-----
> From: Tomas Matousek
> Sent: Thursday, May 21, 2009 2:50 PM
> To: IronRuby External Code Reviewers; Rowan Code Reviewers
> Cc: ironruby-core at rubyforge.org
> Subject: Code Review: Protected3
>
> tfpt review "/shelveset:Protected3;REDMOND\tomat"
>
> Small changes in DLR.
>
> Ruby:
> Fixes handling of CLR protected and private methods and properties.
> Enables generic methods in ClsTypeEmitter.
> Removes RubyCallFlag.TryCall - it''s not used anymore.
>
> Notes on visibility:
> Ruby visibility is orthogonal to CLR visibility.
> Ruby visibility is mutable (can be changed using
> Kernel#public/private/protected methods), CLR visibility is not.
> A CLR method group can comprise of methods of different CLR visibility.
> Ruby visibility applies on the group as a whole.
>
> Ruby-protected members can only be called from a scope whose self
> immediate class is a descendant of the method owner.
> CLR-protected members can only be called if the receiver is a descendant
of
> the method owner.
>
> Ruby-private members can only be called with an implicit receiver (self).
> CLR-private members can only be called in PrivateBinding mode (-
> X:PrivateBinding command line option), the receiver might be explicit or
> implicit.
>
> Tests:
> Since protected methods can only be called on a derived class instance
the
> specs need to be adjusted accordingly.
> I''ve fixed generic_spec nad overload_spec and commented out a
block in
> protected_spec - all the cases there need to be changed to negative cases
> (all should fail).
> Removed ROWAN_BIN check in
> External.LCA_RESTRICTED\Languages\IronRuby\mspec\default.mspec so
> that mspec picks up IR_OPTIONS even if ROWAN_BIN is not set.
>
> Tomas
After chatting with Tomas, not adding those tests makes sense due to differences in CLR protected behavior. I misunderstood his explanation below. JD ...there is no try> -----Original Message----- > From: Jim Deville > Sent: Thursday, May 21, 2009 3:21 PM > To: Curt Hagenlocher; Tomas Matousek; IronRuby External Code Reviewers; > Rowan Code Reviewers > Cc: ironruby-core at rubyforge.org > Subject: RE: Code Review: Protected3 > > For the protected tests, can you add specs that test that the protected .NET > methods are callable from an instance_eval? > > @klass.instance_eval {public_protected_overload("abc")}.should > equal_clr_string("protected overload") > > Don''t worry about protected_spec though, I''ll fix that. > > Other than that, test looks good. > > JD > > ...there is no try > > > -----Original Message----- > > From: Curt Hagenlocher > > Sent: Thursday, May 21, 2009 3:08 PM > > To: Tomas Matousek; IronRuby External Code Reviewers; Rowan Code > > Reviewers > > Cc: ironruby-core at rubyforge.org > > Subject: RE: Code Review: Protected3 > > > > Looks good! > > > > -----Original Message----- > > From: Tomas Matousek > > Sent: Thursday, May 21, 2009 2:50 PM > > To: IronRuby External Code Reviewers; Rowan Code Reviewers > > Cc: ironruby-core at rubyforge.org > > Subject: Code Review: Protected3 > > > > tfpt review "/shelveset:Protected3;REDMOND\tomat" > > > > Small changes in DLR. > > > > Ruby: > > Fixes handling of CLR protected and private methods and properties. > > Enables generic methods in ClsTypeEmitter. > > Removes RubyCallFlag.TryCall - it''s not used anymore. > > > > Notes on visibility: > > Ruby visibility is orthogonal to CLR visibility. > > Ruby visibility is mutable (can be changed using > > Kernel#public/private/protected methods), CLR visibility is not. > > A CLR method group can comprise of methods of different CLR visibility. > > Ruby visibility applies on the group as a whole. > > > > Ruby-protected members can only be called from a scope whose self > > immediate class is a descendant of the method owner. > > CLR-protected members can only be called if the receiver is a > > descendant of the method owner. > > > > Ruby-private members can only be called with an implicit receiver (self). > > CLR-private members can only be called in PrivateBinding mode (- > > X:PrivateBinding command line option), the receiver might be explicit > > or implicit. > > > > Tests: > > Since protected methods can only be called on a derived class > > instance the specs need to be adjusted accordingly. > > I''ve fixed generic_spec nad overload_spec and commented out a block > > in protected_spec - all the cases there need to be changed to negative > > cases (all should fail). > > Removed ROWAN_BIN check in > > External.LCA_RESTRICTED\Languages\IronRuby\mspec\default.mspec so > that > > mspec picks up IR_OPTIONS even if ROWAN_BIN is not set. > > > > Tomas