
On Mon, Oct 26, 2009 at 2:47 AM, Michael Foord <fuzzyman@gmail.com> wrote:
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.
Ok, but that assumes the C extensions are already compiled for CPython on that platform (presumably .NET). This sounds limiting, and hacky (need lots of faith in the DLL loader). I also assume that calls back into the CPython runtime are somehow intercepted and somewhat limited to what is reasonable to support in the .NET world -- unless you basically link all of CPython in and then you might as well just make RPCs to CPython...
My understanding is that Android now allows native code,
Theoretically, yes. I don't think it's a good use of the platform though, you get huge binaries, long startup times, and quite limited functionality. Check out "Android Scripting Environment".
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?)
Not yet, and not easy (the bytecode generator would have to be retargeted and probably a bunch of unsupported Java features would have to be worked around). Phones are slow and small...
then it could work...
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).
How hard was it to get IronPython to work on all? How much of the libraries work on all? Does Ironclad work on all?
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.
Forget I even asked. :-)
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.
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.
Why not just use CPython? At Google we mix Python and Java using RPCs intead of mixing runtimes. It works quite well.
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.)
-- --Guido van Rossum PS. My elbow needs a couple more weeks of rest. Limiting myself to ultra-short emails.