Reflections on O'Reilly OSCon 2003
Well, the second two days were better than the first. I learned to avoid the keynotes entirely, and I picked better sessions to attend. Interestingly, the most memorable ones were mostly social, not technical - discussions on geek volunteerism, and on what sorts of social contracts we should have for web services. There was also a very interesting presentation from someone (I missed his name) from a large financial firm explaining the sorts of software his company needs to run its business. I may focus on that one in particular in a few days.
O'Reilly OSCon 2003
I'm at the O'Reilly Open Source convention this week, and I'm surprised to say I'm really unimpressed so far. I've been two only two other conventions before, one very large (JavaOne) and one smaller than this (the International Python Conference). Both conferences had a lot of energy that this one is missing. There were product announcements, interesting talks on new projects and technologies, it seemed like things were really happening.
Here, it seems there's nothing new under the sun. The talks have largely been uninspired and uninteresting, including today's keynotes. I did go to one talk on Tomcat clustering that had good information, and the one on the Jakarta commons was also decent. That was it for yesterday, hopefully today will be better.
This is also a conference that's clearly on a budget. Breaks consist of coffee only (no bagels, juice, fruit, anything like that), no breakfast, no lunch (except for the bag lunch yesterday provided by Microsoft). Even the vendors have stopped giving things away - t-shirts are $10 and up, and O'Reilly is trying to sell the leftover t-shirts and bags from previous years' conferences.
One other thing: some of these rooms are really small for the number of people attending. I'm writing this right now instead of attending a session because both of the sessions I was interested in this hour are overflowing into the hallway.
Partial application/curry module for Python
By request, I'm releasing a draft of my partial.py module (as mentioned on my Python page), which does things like this:
>>> from partial import _
>>> addWorld = _ + " world!"
>>> addWorld("Hello,")
"Hello, world"
>>> mapcall(_.upper, ["list", "of", "strings"])
["LIST", "OF", "STRINGS"]
This is a work in progress, use at your own risk. I do not expect the interface to change at all but it
is not widely tested and there may very well be bugs. The module depends on updated
versions of other modules in the Xoltar Toolkit,
so I'm releasing updated versions of them as well. I'm not making a Sourceforge release
because I haven't had time to do the sort of testing I'd like to do before making a release. At least
this way, you can try them out. If you find bugs, please report them and I'll fix them (though sometimes slowly).
Here's the documentation:
Void objects are stand-ins, blanks, or holes in an expression,
which can later be filled in. For example:
v = Void()
add_one = v + 1
Now add_one is a function which takes one argument, and returns the
argument plus one. This module exports "_", a single underscore, as
an instance of Void, because it is suggestive of a blank or missing
piece. Here are some more examples:
import sys
from operator import add
adder = add(1,_)
assert map(adder, range(3)) == [1,2,3]
assert (_ + 5)(5) == 10
assert (5 + _)(5) == 10
assert (5 * _)(5) == 25
assert (_ * 5)(5) == 25
assert ((5 + _) * 5)(3) == 40, ((5 + _) * 5)(3)
assert ((5 + _) * _)(3)(5) == 40
assert ((5 + _) * _)(3, 5) == 40
lst = []
(_.append)(lst)(5)
assert lst == [5], lst
unsplit = ["foo", "ba ba", "baz"]
postsplit = [["foo"], ["ba", "ba"], ["baz"]]
assert mapcall(_.split, unsplit) == postsplit
assert mapcall(None, map(_.split, unsplit)) == postsplit
assert mapcall(_.split, unsplit, 'o') == [['f','',''], ['ba ba'], ['baz']]
assert map(_ + 5, [1,2,3]) == [6,7,8]
assert map(_['key'], [{'key':5}]) == [5]
assert map(_[0], [(1,2,3),("a", "b", "c"), (10, 20, 30)]) == [1, "a", 10]
assert map(_[1:3], [(1,2,3),("a", "b", "c"), (10, 20, 30)]) == [(2,3), ("b", "c"), (20, 30)]
if sys.version_info[0] > 2 or sys.version_info[1] > 2:
revtest = map(_[3:0:-1], [(1,2,3),("a", "b", "c"), (10, 20, 30)])
assert revtest == [(3,2), ("c", "b"), (30, 20)], revtest
assert len(((_ + 2) * "foo")(3)) == 15
Download:
partial.py
funtional.py
datastruct.py
Modern Static Typing: Less Code, Better Code
In a recent piece called Strong Typing vs. Strong Testing, noted programmer and author Bruce Eckel makes an argument that dynamically typed languages such as Python are superior to statically typed languages such as Java and C++. I've done quite a bit of Python and Java programming, and even a little C++, so I can appreciate his position, but I think the conclusion goes too far. Whether Python is more productive than C++ or Java is one thing, whether static typing in general should be abandoned is quite another.
More...Nice 0.8 Released
The change notes:
This is a stable release of the Nice compiler. No major feature was introduced since 0.7.9, since the focus was on fixing known bugs. See below for the detail of the changes. We will now start a new cycle of improvements to the language and to the implementation, which will result in the 1.0 release. You can see some planned features at http://nice.sourceforge.net/roadmap.html
This release is an important one because the developers of Nice now feel that the compiler is stable enough that it's ready to be advertised more widely. So, if you've been interested in Nice but keeping it to yourself, tell a friend!
More about Nice Changes DownloadGlasgow Haskell Compiler 5.04.3 Released
The 5 series features some major changes over the 4 series: in short, an interactive development environment, and significantly faster compilation for large programs. 5.04.3 is the latest stable member of this series.
More Details...IntelliJ IDEA
I just got a copy of IntelliJ IDEA at work today, and I must say I'm impressed. I'm usually interested in how languages can improve productivity, but this tool works so well it makes even a verbose language like Java a lot less painful to work with, by automating most of the annoying bits.
It'd be nice to see something like this for Nice, or Haskell...
Back to Nice.
I've always been impressed with Nice, an advanced object/functional language for the Java VM, and recently I've been lucky enough to get to work with it again. Daniel Bonniot's been busy improving his creation while I've been away. The main improvements are the addition of Design By Contract, and big improvements in the Java integration department. Nice now uses standard Java collections without requiring import or modification, but you still get Nice's much stronger type system. It also has a host of great features like multi-methods, anonymous functions, default arguments, etc.
One of the things that's really cool about Nice is that it's based on strong principles of type safety that improve the stability of the code, but even though you get more than Java offers, it takes less work to do it. There are a number of Java extensions which support parametric polymorphism (aka "generics") as Nice does, but Nice does a lot more - look at the Nice solution for avoiding NullPointerExceptions for example. Nice (unlike Java) makes a distinction between a type that may be null, and one that may not be. So, if you want to allow null Strings, you write ?String for the type. If you don't, you just write String. You can't pass a ?String where a String is expected, unless you can prove it's not null. How do you do that? With some absurdly convenient Nice magic:
void foo(String arg) {...}
void bar(?String arg) {
if (arg != null) {
//Here Nice knows arg is not null, so it can
// be passed to a method which takes a String!
foo(arg);
}
foo(arg); //Here arg may or may not be null,
//so Nice gives a compile error.
}
All of this means you never have to check that all your arguments aren't null again, unless you actually want to allow nulls.
A Haskell CSV parser
Just added an example of Haskell in action - a comma separated value (CSV) parser. Reads in a file and produces a list of lists of strings. Supports embedded newlines, commas and quotes. Short and sweet. Here's the code.
Skinning Haskell
One of the nicest things about Haskell is how much you can customize it to suit your tastes. For instance, maybe you've been using Python for a while now and you've admired its uniform notation for accessing elements of all manners of sequences and mappings. When you switch to Java, it's likely to drive you crazy that you can't foo[0] an ArrayList, only a plain old array. You think "Gee, foo.get(i) and foo[i] are basically the same concept, it's a shame I have to write it two different ways". With Haskell, you can have all the type safety (and much more) that Java offers, with the uniform notation that Python offers. More...
ICFP 2002
Every year, the ICFP puts on a programming contest. Your team has 72 hours (or 24, if you enter the lightning division) to solve the contest problem. I participated last year, and this year also, and it's always a lot of fun. It didn't go well for me either time, though. Rules for next year:
- Find a team to join. I just don't have time to do everything by myself, especially in the lightning round
- Write in a language that actually catches errors before runtime (I'm thinking Haskell).
- Have a Linux box on hand - the judges always use Linux, and any utilities they provide (test servers, this year) will generally only be provided for Linux.
- Research the problem first. Somebody has already spent a lot of time solving this problem before, and you don't have time to figure it out yourself.