[IronPython] Protected members breaking change...

Dino Viehland dinov at exchange.microsoft.com
Tue Jul 29 01:41:31 CEST 2008

We're soon (post-Beta 4) going to be making a breaking change which will alter how protected members are exposed.  Currently outside Silverlight or other partial trust scenarios you can access protected members on any type.  For example today you can do:

import clr             # required for access to .NET members on object

in beta 3 this started issuing a warning* so if you've been doing this hopefully you've stopped :)  You will still be able to do:

class x(object): pass


as you will then be accessing the type through a derived type.   Likewise we'll need to make sure that things like super continue to work as well.

The main reason I'm sending this out is just so that everyone is aware of the upcoming change.  But also I wanted to let you know of one breaking change.  That is that you will no longer be able to access protected nested classes.  So if in C# you've written:

public class Outer {
                protected class Inner {
                                public int x = 3;

And in Python even if you subclass this:

class x(Outer): pass

you will not be able to access Inner.

The reason why we won't support this is really just a matter of prioritization of work - we could enable richer .NET interop here if anyone was interested.  But so far this seems like a sufficiently narrow corner case and it  requires a significant amount of work so we're just trying to punt on it.  Furthermore it's not a very interesting corner case because .NET design guidelines recommend against having non-private nested classes.

If this is problematic for anyone please let us know.  Thanks!

*(that warning is overly aggressive so just because you see it doesn't mean you're doing something wrong)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080728/8d29409b/attachment.html>

More information about the Ironpython-users mailing list