[IronPython] Similarity with builtin types

Dino Viehland dinov at microsoft.com
Mon Aug 9 19:46:25 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.

+1 on allowing the types, that's a good idea.

My biggest concern w/ using import semantics for this is Brett's goal 
(which I am +100 on) to move to a Python implementation of import.  
Once that happens it'll be either very difficult or impossible to 
make this syntax work.  Even import clr will need to change to be 
something we recognize at compile time like from __future__. So I'm 
inclined not to do that - plus it may be boarding too close on 
embracing and extending :)






More information about the Ironpython-users mailing list