[sapug] Introduction

stephen white steve at adam.com.au
Tue Feb 14 07:13:05 CET 2006


On 14/02/2006, at 12:58 PM, Chris Foote wrote:
> Any reason for using Smalltalk over Ruby ? (i.e. If you progressed  
> from
> Ruby to Smalltalk, then there must have been some benefit).  How on
> earth did Objective C sneak in there ?

Now you're asking me to be a Smalltalk Troll, when I'm supposed to be  
talking Ruby up... :)

I also come from the C world, and had been greatly unimpressed with  
OO languages. I'm still the same way now, considering properly  
implemented OO as being conceptually similar to separate processes  
communicating with messages, or Charles Moore's concept of thousands  
of microprocessors in one computer. Since the OO languages like C++  
contained mashed up baby in the bathwater, I had disregarded the  
entire concept and was struggling with implementing seperate areas  
within the one namespace.

Discovering Ruby, and the way that it carefully retains procedural  
syntax within co-operating objects, was a breath of fresh air. I  
would argue that OO programming is in fact a way of re-introducing  
all the 'evil', yet practical, ideas like global variables and  
gotos... within namespace playgrounds to limit the program wide  
effects. This is a good thing as far as I can see, as scoping  
variables before using them is a hit and more often miss exercise in  
frustration and rewriting.

I imagine that Python is much the same... just that I had my hit of  
old time, nothing to do with inheritance, OO programming with another  
scripting language by chance. There are other features of Ruby that  
made accessing other ideas, like lambda, very simple and  
straightforward. There's nothing at all mysterious about passing  
blocks, and the libraries are designed with blocks in mind, so it's  
just the way things get done.

On the other hand, Ruby has no native GUI libraries and I wanted a  
single set of libraries or frameworks that were written in a  
consistent manner, that handled just about everything without plugins  
or add-ons, and had loads and loads of documentation. And definitely  
not C++. So I ended up getting a Mac with OS X and Cocoa specifically  
for its compatibility with Ruby's semantics. And I waited, and  
waited, and I'm still waiting.

The hang-up is the simple fact that Ruby doesn't have parametric  
keywording... that is to say, it doesn't have in-fix notation for the  
names of arguments:

	    [shortStatusText setStringValue:@"Picture Sharing is off."];

This is equivalent to:

	shortStatusText.setStringValue("Picture Sharing is off.");

which doesn't have any readily apparent advantage, until you start  
using multiple arguments:

	options("hello", "there", "world");

Is it the first argument that is the default option? Or the last? Is  
there even a default option? Better check the manual!

	[options firstChoice:@"hello" secondChoice:@"there"  
defaultChoice:@"world"];

Makes it very obvious without needing any further investigation. It  
is very much worth the extra typing, and stuff becomes directly  
commented without the problems of updating, rewording or having  
potentially out of date comments next to functional code.

RubyCocoa does have some hacks to get around the lack of parametric  
keywording, but they depend on gross megapukage wrappers like SWIG.  
Plus all the attendant problems of not being able to call unwrapped  
code, hence unable to load in C libraries, unable to add your own C  
extensions, etc etc and so many edge case situations that it's like  
programming in a straitjacket - which are the same problems Python  
has too.

So, having observed that Objective C is capable of blocks and filters  
and callbacks, had the same OO model as Ruby, fully supported  
procedural programming, could be compiled to executables, extended  
with native C code, and ran very quickly by its nature... I made the  
jump across. It's not all roses, but it appears to be the best of 4  
worlds. I'm still looking for a better Smalltalk scripting layer on  
top, but I don't use Smalltalk the language itself as I'm not fond of  
the image model as used by Squeak and traditional implementations.

I still use Ruby as a quick way of massaging text from the command  
line, as it has built in Regexp and is much more concise in its  
syntax. Ruby 2.0 may address some of these concerns, but being able  
to compile Objective C and mix-n-match the best of 4 very simple  
languages (assembler, C, ObjC, Smalltalk) is very compelling. It's  
counter-intuitively strange that none of these 4 languages cause any  
confusion, unlike the standardised C++ syntax where very similar  
looking code represent entirely different concepts!

Troll!

PS. You fed me trollbait after midnight. :)

--
   steve at adam.com.au




More information about the sapug mailing list