[IronPython] Similarity with builtin types

Dino Viehland dinov at microsoft.com
Mon Aug 9 23:17:15 CEST 2010

Jeff wrote:
> On Mon, Aug 9, 2010 at 11:25 AM, Dino Viehland <dinov at microsoft.com> wrote:
> > clr.LoadClrExtensions(namespace)
> I'd like to paint the bikeshed 'clr.ImportExtensions()', if possible,
> and have it take either a namespace or a static class - i.e.
> System.Linq or System.Linq.Enumerable.
>     import clr, System
>     clr.ImportExtensions(System.Linq)
> Looks fine to me.
> For a shorter syntax, I would prefer
>     from System.Linq.Enumerable import *
> and have it pull in any extension methods in that class. My only
> concern is that it's a little too magical, and doesn't match the usual
> behaviour of an import statement.

Ok, +1 on ImportExtensions for the name form me.

There's also 1 limitation which occurs to me:  We will only allow extension
methods which don't clash on the base class to appear.  So for example if you

class MyClass : IEnumerable<object> {
	public void Where() {

Then the extension Where won't be available.  Unfortunately I think that's the
only way we can really do this efficiently.  Of course you'll still be able to
call System.Linq.Enumerable.Where.

Sound reasonable?

More information about the Ironpython-users mailing list