[Pythonmac-SIG] NSTableView and NSOutlineView backgrounds

Nicholas Riley njriley at uiuc.edu
Tue Oct 14 14:20:27 EDT 2003


On Tue, Oct 14, 2003 at 01:00:13PM -0400, Bob Ippolito wrote:
> Also, don't the newer compilers complain when you declare variables in 
> the middle of code?  Wouldn't you have to put a "NSRect bounds;" at the 
> top of the block?  Obviously you could just do [NSBezierPath 
> fillRect:[self rectOfRow: row]] .. which is probably how I'd have done 
> it in the first place.

Actually vice versa; GCC 3.0 and later-based compilers support C99
variable declaration syntax for ObjC, meaning you can declare a
variable anywhere in a block.  It's very useful.

I learned the languages (using each for one or more major projects) in
the order Python, Smalltalk, then ObjC.  While there are some features
in each language I wish were in the others, over time I found myself
appreciating the _longer_ method names in ObjC, for their clarity and
consistency.  The equivalent of -[NSArray objectAtIndex:] and
-[NSDictionary objectForKey:] in Smalltalk is simply #at: - i.e.,
|array at: 3| or |dict at: 'hi'| would work as in Python, array[3] and
dict['hi'].  Especially, I like the consistent way in which ObjC
constructors tend to be named.

Smalltalk's syntax for method declaration is a lot more consistent
than Python's; none of this special __ism for what otherwise would be
considered operator overloading (Smalltalk binary messages such as #+
and #,).  Of course, Smalltalk has its issues masquerading as
'consistency' such as weird operator precedence.

That said, over the course of my language-learning journey Python has
evolved from 1.5.2 to 2.3.2, and many of the deficiencies I perceived
in Python have disappeared.  The biggest language-level problem for me
now: I still wish Python lambdas worked more like Lisp or Smalltalk
blocks; they're too confusing and limiting for functional programming
as is.

-- 
=Nicholas Riley <njriley at uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>



More information about the Pythonmac-SIG mailing list