Forum: IronRuby Code Review: Protected3

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.
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-05-22 00:33
(Received via mailing list)
Attachment: Protected3.diff (50 KB)
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
F983f0c990cba2fe743ef62a975ec99c?d=identicon&s=25 Curt Hagenlocher (Guest)
on 2009-05-22 00:39
(Received via mailing list)
Looks good!
Ade8632553a9243ae05fc920f68644c1?d=identicon&s=25 Jim Deville (Guest)
on 2009-05-22 00:44
(Received via mailing list)
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
Ade8632553a9243ae05fc920f68644c1?d=identicon&s=25 Jim Deville (Guest)
on 2009-05-22 00:56
(Received via mailing list)
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
This topic is locked and can not be replied to.