Saturday, March 18, 2006

JSR292

There is a very interesting development in the Java language which is to put in support for dynamicly typed languages and hotswapping, the runtime addition and subtraction of fields and methods like Object Rexx, Objective C, Ruby and some other languages can do. Gilad Bracha, who blogged about it, doubts whether there can be full hotswapping support for a mandatory typechecked language like Java, but even if that is not feasible, it should be in for the dynamic language support.

My take on this is that is mostly better to have strongly typed constructs, but for speed, shortcuts and prototyping I am sometimes tempted into using those luxurious and rather untyped Rexx strings. Sometimes they stay, and at other times I opt for replacing them with (types) classes, mostly because I find it easier to keep a good oversight when things are called what they are. Rexx strings are their own unique type, because they allow you to do (multiprecision) arithmetic on strings, which is sometimes very welcome, mostly when doing things with strings. As we move to metaprogramming, by which I mean the runtime manipulation of types and classes and simultaneous use of those, we need to go more dynamic as we might be hampered by an extra compile cycle. Of course most cases where dynamic typing seems to be necessary can be solved by generating source and calling the compiler one more time.

Tuesday, March 14, 2006

Make again

Now what totally baffled me is that James Duncan Davidson's personal webpage states Make among the languages that he knows well. A bit further down the page he states that "I no longer, however, consider Makefiles to be evil. In fact, I’ve written several in the last few years." 

Now this is fine, and only troubling when you know that this is the man who made Ant, the build tool of choice of all Java persons. To build something using Ant, you have to write a Java program, at least if somebody else did not do that yet. Netbeans was ruined for me by Ant, and in its latest versions really deletes your sourcecode when it does not understand a cross language reference or something else in that vain. Actually, he also left Java and went to Ruby, which is a sensible choice, if you are in a position to choose. He also likes Objective-C and Cocoa, which is also sensible. Let's write off Ant to his job at Sun, then. I would like though, that we could undo some of Ant's damage, and have, for example, NetBeans working again with "make" projects.

Sunday, March 12, 2006

Scott's Pragmatics has scripting chapter now

The good news is that the latest version of Micael Scott's "Programming Languages Pragmatics" has a whole new chapter dedicated to scripting languages, and mentions Rexx various times. The bad news, however, is that coverage is sketchy, no doubt because it is impossible to know every programming language intimately, but to Rexx this is particularly unfair, because although its age is mentioned and it gets a honorary mention as forerunner of this whole field, lots of the good parts of Rexx are largely neglected.

Rexx is even not mentioned in the chapter that has a short description of every language that is mentioned in the book. Rexx's great assets, like unlimited precision arithmetic out of the box. the unique 'parse' and 'trace' statements, incredible string handling, object orientation including metaclasses, runtime addition of methods and properties, reflection and concurrency, are not mentioned at all. It might be that it is an old language and some languages have caught up with it more or less, but that does not mean that we need not mention the genesis of thing in the right historical order. The problem was, I think, that Rexx has been closed-source IBM proprietary for a long time of its existence; if it had been opened up earlier there would have been no reason for Python and Ruby. Larry Wall, who did Perl, visited one of the first Rexx Language symposia to explain what he thought that Perl had to offer, and indeed the similarity between Object Rexx and Ruby is enormous.

I think it is our duty to be at the same time thankfull to Scott for mentioning the root of scripting and mentioning Rexx in his book, but also to correct him in his fairly superficial treatment of our favourite language.

Saturday, March 04, 2006

Shoddy Typing needs more typing

What Bruce's book did make me realize was that although I agree on having some typing eliminated, his arguments against strong typechecking are not that sound. Actually, we get the impression that he sees it as a nuisance causing clerical work; that is not a very good argument against it. If you look at what Rexx does, it gives you a type that can be String and numeric and treats it the same way; now if you go and do impossible things, you'll be flagged at runtime. NetRexx also has almost the same approach, but it also blends in with Java's type system,  so there is actually a wide choice for the programmer to choose from. I have the distinct impression that strong typing is an asset and not a liability; *when your model is sound* strong typing (and we even type our yes/no binary schemes to a more specific type than boolean) only helps you to avoid errors. When dealing with metadata in your application, like model- and meta model data, it is essential in avoiding layering errors that are too easy to commit without strong typing. Where he does hit the hammer more or less on the nail is in the difficulty of having generic algorithms when strongly typing, but this also can hint to a too procedural approach, in which parts of the algorithm are not well hidden in the objects. This is called polymorphic; I am sure that Bruce knows.