Tue 04 Jan 2005
Set Yourself On Fire
Nobody told me there was a
new Stars album out on the 24th October last year! Apparently it's like the best bits of
Heart, stretched out into a whole album. And I thought most of
Heart was absolutely top-notch.
Now, do I pay Amazon £10.99 and wait 4–6 weeks, or get it from an Amazon Marketplace seller for £7.72, shipped on the 6th January straight from Canada? No-brainer.
I cannae wait!
Posted at 2005-01-04 15:45:00 by Richard • Link to Set Yourself On Fi…
, trackbacks.
LispWorks, Ltd.
Xanalys has now split off its LispWorks division into a separate company,
LispWorks, Ltd. Based in Cambridge (England, of course, not Massachusetts!)… hmm, I like Cambridge….
Posted at 2005-01-04 13:41:26 by Richard • Link to LispWorks, Ltd.
, trackbacks.
Enumeration
Ken Ferry kindly writes to point me to Jonathan Rentzsch's
page on Objective-C's enumeration approach. I'd previously seen his excellent “
Love, Hate, and Objective-C” page, but I'd missed this one.
He quite rightly points out some annoyances about using NSEnumerator that I
alluded to:
- Too many lines of code
- Namespace clutter from iteration variables (causes problems with multiple iterations
- Type problems.
Jonathan's solution is to hit the ol' C macros, allowing you to change
NSEnumerator *e = [myArray objectEnumerator];
id o;
while ((o = [e nextObject]) != nil) {
// Do something
}
into
nsenumerat( myArray, o ) {
// Do something
}
A bit of an improvement, and it's extensible to
keyEnumerator. However, I don't think it's a big enough leap when I'm used to mapping lambdas over lists in a single sexpr.
Ken also points out
trampolining, which I've seen before, but (and I think Ken is with me on this one) I don't want to be heavily reliant on third-party code. I think the crux of my point (which impinges on many of my other points about verbosity) is that Objective-C just doesn't allow the extensibility that is necessary to cut the code down. Consider Java; adding synchronisation and generics required changes to the language itself (special keywords and syntax, respectively).
The same is true of Obj-C (excluding pre-processor macros, of course, which
don't count!). If you start adding in lambdas/blocks to the language, emulating macros, &c, then it's starting to prove Greenspun's Tenth.
Ken also points to
F-Script, but I'll save that for a private reply, as this entry's too long already! Take a look; it's
very interesting.
Thanks Ken!
Posted at 2005-01-04 13:19:10 by Richard • Link to Enumeration
, trackbacks.
On concision
In recent weeks I have been writing a fair amount of code, and my
RSI has begun to recur, giving me aches, pains, and burning sensations in my wrist and elbow.
There are two reasons for this.
Firstly, I have been coding as exploration; writing code, then fixing it, then changing it, constantly compiling and running to see what happens. That results in a lot of wastage: code I have typed but does not appear in the final product. This is analagous to writing an essay in a word-processor without planning; you spend a lot of time changing things.
Secondly, I have been using Objective-C and Cocoa. The former is not a particularly concise language; it's better than some, but nonetheless I've been writing a lot of code. Furthermore, it's not great for drafting; better than C++, say, because of its dynamic typing, but I'm doing a lot of dull iteration over arrays, retaining and releasing, getting strings, and so on, then deleting chunks. I have also been using Cocoa programmatically, which is a bad idea. Dropping an NSButton onto a window in Interface Builder is easy; building one in code takes about 5 lines (or more).
Finally, Xcode just doesn't meet my editing needs: autocomplete slows me down, making me hit Escape and the arrow keys constantly, and forcing my to delete extraneous brackets that it has helpfully inserted. Also, being a “standard” text editor, there's a lot of hitting arrow keys and going for the mouse to move around. I'd be better off in Vim.
What should I do? Well, I have two preferences.
- Switch to a more concise language, ideally with fewer syntactic wafflings, which uses macros and higher-order functions to reduce common operations to naught;
- Switch to another editor in which source editing is easier.
I should also sit down and plan whenever I can, though using a more concise, dynamic language would reduce the impact on the source of changes in design.
In other words: who's going to write me a Vim-like IDE with a complete Lisp—Cocoa bridge? :)
I suppose writing shorter and fewer blog posts would be a step in the right direction, too…!
In other news, Marc, Tim, and I are hitting the gym on Thursday for our induction. It's not a New Year's Resolution, I promise — we formalised our intent to go in December!
Posted at 2005-01-04 08:44:32 by Richard • Link to On concision
, trackbacks.