Rob Lally gave Smalltalk (Dolphin) a whirl, and came away with a few things I'd like to comment on - mostly because I think these are the sorts of problems a lot of people looking at Smalltalk for the first time have. Not on knock on them - or on Dolphin, for that matter - we (the Smalltalk community at large) need to do a better job of education. I tried commenting on Rob's site, but my comment inexplicably bounced. So.... in recreating a Ruby script, Rob decided to create a workspace script:
Firstly - workspaces in Dolphin are built around a piss poor text control. They have only a single level of undo, no way to show line numbers that I can see, syntax highlighting that only works properly after you've evaluated the text, no regular expression search and replace support, no text completion - even of words already in the same file. I haven't worked in a text editing environment that bad in years. Possibly ever in fact. Apparently the quality of the underlying text control used is a general source of unhappiness and has been replaced by the scinitlla control in the next version out in the next month or so.
Well, text controls have never really been something Smalltalkers have focused on. It's because we tend not to write large masses of text - we create a class, create a method, and save that. The methods we save tend to be short - typically 10 lines or less. In 10 lines, there's just not that much editing power needed - which explains why the community has never really focused on the problem. I'm not really trying to excuse this lack so much as explain it - people tend not to solve problems they don't encounter :)
Next, Rob had a few things to say about Dolphin's file and DB libraries. Not having used them, I can't really comment one way or the other, so I'll skip forward to something that jumped at me:
One thing that bothered me was that there were chunks of code that I wanted to turn into functions/methods. In Ruby I'd simply declare a free standing function. Here this was not an option - I had to duplicate the code.
Smalltalk has what Rob wants - it's called a block. Heck, I've even blogged on the kind of usage he's talking about. I ship a script runner with BottomFeeder, which was written by Bob W. In the scripts I've written, I'll often need the kind of function Rob's after here - what we call a block in Smalltalk. Here's an example from one of my scripts:
contentBlock := [:builder :chunk :stringToLookFor |
| lnk |
lnk := 'http://www.dilbert.com', chunk trimSeparators.
builder link: lnk.
builder guid: lnk.
builder title: stringToLookFor, Core.Date today printString.
builder description: '<img src="', lnk, '">'.
builder pubDate: Core.Timestamp now].
There's a reusable function, in Smalltalk form. Actually, so far as I know, the Ruby closure support is modelled on Smalltalk's feature. In any case, I just figured I'd add my two cents to clear things up.