Part of the problem is that Python has a very different view of classes
to C#. In Python, classes are created at runtime (and can be modified at
runtime of course) - whereas C# needs a static target at compile time to
compile against.
One possibility is a project started by Curt called 'coils', which will
take a Python class and generate a static type from it that actually
proxies the Python type.
http://www.codeplex.com/coils
This is in an early stage, but can undoubtedly be made to work. Once my
book is finished I would like to contribute to it...
Michael Foord
Dino Viehland wrote:
It's something we've actually tried once - in v1.x we have a static compiler
which produces real .NET types. But it's incredibly hacky so I wouldn't
suggest anyone to try using it. The big problem with doing this is we
basically create P# instead of Python. For example what does:
from foo import *
class x(object):
pass
produce? Is this really a subtype of object?
Another big problem is the API that is exposed to C# isn't very friendly to the
C# programmer - everything needs to be typed to take and return object. The
only exceptions to this today are when we detect you're overriding a virtual
method.
Instead we're much more excited about the whole DLR thing and the possibility
of broadly supporting dynamic dispatch from within static languages - something
along the lines of
http://blogs.msdn.com/charlie/archive/2008/01/25/future-focus.aspx. If/when
that happens it will solve a large class of the problems of consuming
IronPython objects from static languages.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Kubasik
Sent: Friday, May 30, 2008 11:52 AM
To: Discussion of IronPython
Subject: Re: [IronPython] static compilation of Python scripts
Is this something that might happen in the future? I see some
translation problems, but hypothetically there could be some cool
potential, especially in the enterprise field.
-Kevin Kubasik
On Fri, May 30, 2008 at 4:33 AM, Sanghyeon Seo <[EMAIL PROTECTED]> wrote:
2008/5/30 Ben Aurel <[EMAIL PROTECTED]>:
Is it possible to build an assembly that exposes the contents
(types,...) when imported into a C# class the same way if it would
have be written in plain C#?
No. Not currently.
--
Seo Sanghyeon
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
--
Kevin Kubasik
http://kubasik.net/blog
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
--
http://www.ironpythoninaction.com/
http://www.theotherdelia.co.uk/
http://www.voidspace.org.uk/
http://www.ironpython.info/
http://www.resolverhacks.net/
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com