Just A Summary

Piers Cawley Practices Punditry

Holy wha?

Okay, so I know GUI coding’s a pain in the bum. I know that the windows libraries aren’t the most friendly. I know it’s not fair to point and laugh.

But… → IronPython Hello World Tutorial

Bwah hah ha ha.

Of course, I don’t doubt that huge amounts of the boilerplate hoopage in the code shown can, and will, be abstracted away. But right now it’s just painful.

IronPython’s one hell of an achievement though. If there’s any justice in the world, it deserves to get out there and kick C#’s arse good and proper, at least in the .NET context. But still.

Published on Wed, 04 Oct 2006 06:20:00 GMT by Piers Cawley under . Tags

If you liked this article you can add me to Twitter
  • Gravatar

    By codepope Wed, 04 Oct 2006 09:20:00 GMT

    And let’s be a little more fair, this is a Hello World using IronPython and XAML for the GUI layer…

    Just for reference, the Java Swing code at least goes in a straight line, but that XAML layer does buy you quite a bit of flexibility.

    —-—-—

    <pre> package helloworld;

    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;

    public class HelloWorld {

    public static void main(String[] args) { JFrame jf=new JFrame(“Hello World”); JButton jb=new JButton(“Press Me…”); jb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); }}); jf.add(jb); jf.setVisible(true); }

    }


  • Gravatar

    By Piers Cawley Wed, 04 Oct 2006 09:20:10 GMT

    Oh, I know. I never said I was being fair. There’s lots of opportunity to hide the hoopage behind a more opinionated interface.

    That Java code’s rather neat though – did Java get blocks while I wasn’t looking or am I misunderstanding the workings of ActionListener?


  • Gravatar

    By Simon Willison Wed, 04 Oct 2006 10:20:00 GMT

    That’s an anonymous inner class – ActionListener is an interface, but in Java you can create anonymous inner classes that implement that interface using the idiom shown above. It’s not a new feature – it’s pretty common in Swing code.


  • Gravatar

    By Alan Burlison Wed, 04 Oct 2006 10:20:10 GMT

    It’s an anonymous inner class. The code is creating an unnamed implementation of the ActionListener interface, defining the actionPerformed() method of that anonymous class and then creating an instance of the aforementioned class and then passing it to jb.AddActionListener(). It’s a standard idiom, used heavily in Java GUI programming, amongst other places.

    Thisis as close as Java (currently) comes to supporting closures, although they are coming in Java 6


  • Gravatar

    By Alan Burlison Wed, 04 Oct 2006 11:20:00 GMT

    Gah, that’s Java 7, not 6 of course. Here’s a list of stuff slated for 7. Interestingly there’s also a slew of stuff being added to the JVM for supporting dynamic languages. Perl6 on the JVM, anyone?


  • Gravatar

    By Piers Cawley Wed, 04 Oct 2006 11:20:10 GMT

    Hey, so long as it passes the test suite it’s Perl 6. Stranger things have happened.


  • Gravatar

    By Alan Burlison Wed, 04 Oct 2006 11:20:20 GMT

    Just don’t look to me to do it ;) My views on Perl6 are fairly well known :)


  • Gravatar

    By Piers Cawley Wed, 04 Oct 2006 11:20:30 GMT

    Yes. I remember


  • Gravatar

    By Alan Burlison Wed, 04 Oct 2006 12:20:00 GMT

    I remember discussing the question of using the JVM for Perl6 may years ago with Dan. At the time he didn’t feel it was right for Perl6, but in hindsight (a wonderful thing) I think that was probably the wrong decision. There’s a whole slew of scripting languages now available on the JVM, and much work going on in the area – for example Sun have just hired the JRuby folks. I’m pretty sure the reason the JVM is attractive for scripting language developers is that you get all the functionality in the Java class libraries for free, so they don’t have to build the equivalent of CPAN themselves.


  • Gravatar

    By Piers Cawley Wed, 04 Oct 2006 15:20:00 GMT

    I think Perl 6 has got a good deal more pragmatic since then.

    Okay, I’m speaking from a position of ignorance here, but I’m not entirely convinced that the Java class libraries are a big win for dynamic languages without a good deal of work to make them play well with duck typing, closures and the other dynamic goodies.

    I’m more convinced that it’s worth porting dynamic languages to JVM to get the benefits of all the optimization that it’s had over the years. For instance, I have the feeling that JRuby’s will end up faster than CRuby.


  • Gravatar

    By chromatic Wed, 04 Oct 2006 19:20:00 GMT

    The JVM would have to be portable, redistributable, and hackable to be even worth considering as a primary platform for Perl 6.

    (Yes, I said “portable”. Modern versions of Parrot and Mono run on Linux/PPC. Modern versions of Sun’s JVM don’t.)


  • Gravatar

    By Alan Burlison Wed, 04 Oct 2006 20:20:00 GMT

    Actually, duck typing has been done in Java already – see Wikipedia and here, and as I said, Java has kinda-closures, and work is ongoing to add them as first-class citizens.
    Having said all that, I’m sure the optimisation stuff is a big win too :)


Comment Holy wha?

Powered by Publify – Thème Frédéric de Villamil | Photo Glenn