<br><br><div class="gmail_quote">2009/10/26 Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org">guido@python.org</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Sun, Oct 25, 2009 at 5:12 PM, Michael Foord <<a href="mailto:fuzzyman@gmail.com">fuzzyman@gmail.com</a>> wrote:<br>
><br>
><br>
> 2009/10/25 Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>><br>
>><br>
>> On Sun, Oct 25, 2009 at 4:38 PM, Michael Foord <<a href="mailto:fuzzyman@gmail.com">fuzzyman@gmail.com</a>> wrote:<br>
>> > Well, you can use Python C extensions with Ironclad [1]. The maintainer<br>
>> > hopes to port the core to Jython at some point as well.<br>
>><br>
>> What do you personally think of Ironclad? And (separately) of those hopes?<br>
>><br>
><br>
> It seems like it ought to be an impossible task - reimplementing the Python<br>
> C API for another platform. It actually runs surprisingly well<br>
> (astonishingly) and I know of at least one bank in London now using it in<br>
> production. The Ironclad implementation reuses the Python C source wherever<br>
> possible in order to minimise the core that actually needs implementing.<br>
><br>
> A *large* number of the Numpy and SciPy tests pass with it (~1000 of each<br>
> last time I checked) and *generally* performance is pretty good. I'd like to<br>
> see Ironclad in wider use.<br>
><br>
> The hopes of the Ironclad maintainer to reimplement the core for Jython is<br>
> certainly *plausible*, but it of course depends on him finding time in the<br>
> future.<br>
><br>
> Personally when I write IronPython code I try to avoid a dependency on C<br>
> extension modules as it seems to me that the *point* of IronPython is to<br>
> make use of the .NET framework (otherwise you might as well just use<br>
> CPython). Where Ironclad is being used is where people want to interface<br>
> existing Python systems to existing .NET systems and that makes a lot of<br>
> sense (you'd rather avoid rewriting chunks of either if you can and Ironclad<br>
> acts as a bridge).<br>
<br>
</div>Hm. In the Java world, there are many target environments where<br>
depending on C extensions would not fly at all, since the only<br>
commonality between platforms is the JVM interface. (And sometimes not<br>
even that -- e.g. Android uses a different VM to run Java.) I'm<br>
guessing that in the .NET world this is much less of an issue, since<br>
(a) the platform is more homogeneous and under control of Microsoft<br>
(Mono notwithstanding) and (b) .NET explicitly targets other languages<br>
(though it prefers "managed C++", it supports plain C++). Have I got<br>
this right? I see the prospects for an IronClad-like thing in the Java<br>
world as pretty slim because of this.<br></blockquote><div><br><br>Hehe, you actually raise several points in that short email. I'll address them one by one and try not to ramble too much.<br><br>Firstly, although you are correct that .NET supports a managed variant of C++ (that runs 'on .NET') and it is the same set of tools that you also use to compile native code (unmanaged C/C++) this has nothing to do with .NET. Python for Windows is compiled with the Visual C++ compiler but it doesn't run on .NET. .NET doesn't even use the MSVCRT that compiled native code links against - something that causes Ironclad 'difficulties' when managed and native code need to share file handles.<br>
<br>Ironclad itself has binary compatibility with Python C extensions, they don't need to be recompiled. It uses the .NET FFI (P/Invoke) to work with these extensions and on the JVM would use its FFI.<br><br>My understanding is that Android now allows native code, so if Dalvik has the same FFI APIs and you can compile the Python extensions for it *and* Jython runs on Dalvik (not currently the case I believe?) then it could work...<br>
<br>The .NET framework, even leaving aside Mono, is also diverse. There are several versions of the .NET framework: .NET CE (Compact Edition) that runs on mobile devices and the XBox 360, CoreCLR that runs on Silverlight and an embedded version. There is also a Mono application called MonoTouch that compiles .NET code for the iPhone (using Ahead Of Time compilation to generate native code).<br>
<br>The embedded version will never support IronPython. The compact edition of .NET currently lacks the System.Reflection.Emit (code generation APIs) that IronPython uses. You aren't supposed to use interpreters on the iPhone so likewise System.Reflection.Emit can't be compiled with MonoTouch. I mention them because the Microsoft dynamic languages team are looking at a cut down version of IronPython (with some of the more dynamic features restricted) that can run on .NET CE and could be compiled with MonoTouch. It is possible that Ironclad could work with this.<br>
<br>The CoreCLR in Silverlight does run IronPython but because of the sandboxing you can't call into native code, so you can't use Ironclad in the browser.<br><br>Despite the places where Ironclad doesn't work, *most* .NET code runs on desktops or servers using the standard .NET framework - and this is where Ironclad is used. Despite the variety of different JVMs this is an analogous situation and I don't see why a port wouldn't be just as useful.<br>
<br>As for Mono; Ironclad *currently* only works on .NET and on Windows. This is because it was originally created by Resolver Systems who only develop for Windows. There was *some* work by Seo Sanghyeon to port Ironclad to Mono, and there is nothing about the techniques Ironclad uses that would prevent it working on Mono. (Seo got distracted and the work was uncompleted but we're looking for volunteers to pick up porting Ironclad to Mono.)<br>
<br><br>All the best,<br><br><br>Michael Foord<br><br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
> Michael<br>
<div><div></div><div class="h5"><br>
>> > [1] <a href="http://code.google.com/p/ironclad/" target="_blank">http://code.google.com/p/ironclad/</a><br>
<br>
--<br>
--Guido van Rossum<br>
<br>
PS. My elbow needs a couple more weeks of rest. Limiting myself to<br>
ultra-short emails.<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.ironpythoninaction.com/">http://www.ironpythoninaction.com/</a><br><br><br>