Ranga, >> On Wed, 2 Jul 2003, Ranga Nathan <[EMAIL PROTECTED]> said:
> Has anyone played with Perl on .Net platform? Good, bad or ugly? Depending on what sort of integration with .NET you want, I'd scale it from ugly to impractical. If you're looking for a way to construct .NET attributes, events, delegates and the like through Perl, ActiveState might be able to help you. If you're looking for a compiler to retarget Perl code at .NET, you're not going to find one. The team who created Jython -- porting Python into the JVM -- tried to follow Jython with Python.NET, and as far as I know they've given up. I'm going to offer this is an aside that might be interesting; for my undergrad thesis I retargeted a Java compiler at .NET, and ran into problems related to those found by the Perl and Python ports, even though I was using Java which is similarly typed. My main problems came from the static typing for local variables in a method's preamble. Under the JVM, a method's bytecode must give a maximum stack depth for a method. For example: void method(int a) { if (a == 5) int b, c; else float d, e; } Here, a Java compiler performs liveness analysis and decides that only two local variables (the argument's kept in a separate argument stack) will be used in the method's lifetime. Under .NET, you need to specify a _method-scoped_ type for each local variable you specify. So, using a C# compiler to compile the above I see four locals instead of two: .locals init ( int32 V_0, int32 V_1, float32 V_2, float32 V_3 ) This meant that I needed to disable reusing local variables in my Java compiler, and that the .NET runtime was asking for type information that I just didn't have to give it -- Java just doesn't type local variables. You can see how this creates problems for a Perl or Python port, too. When $a goes from being an IV to an PV, what do we do with the local variable preamble? Do we push one of each type at compile-time and keep track of which one is live at one time? Do we try to use a user-defined type to encompass Perl's idea of a scalar somehow? Do we interrogate our running Perl VM inside .NET at runtime? It's for these reasons that Perl and Python compilers for .NET don't exist, I believe. All the same, there's a great whitepaper[1] from ActiveState regarding a Python compiler that talks about why it's too slow to be useful. > But I dont want to spend the time if .Net is 'closed' with no role > for Perl. While I haven't done the research, I don't see a future for Perl in .NET's type system. Hope this helps, - Chris. Footnotes: [1]: http://www.activestate.com/Initiatives/NET/Python_for_.NET_whitepaper.pdf -- $a="printf.net"; Chris Ball | [EMAIL PROTECTED] | www.$a | finger: [EMAIL PROTECTED] _______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm