User talk:Wlievens/Why I Don't Like Smalltalk

What version of VW are you using that asks if you want to change all nnn occurances? I use VW and GS extensively and have never seen that message when I want to simply change a method name.


 * Any version. When you rename a method, all occurances of it are renamed, because the IDE does not have the type information to rename them in an intelligent way. Wouter Lievens 21:52, 29 Mar 2005 (UTC)

Some comments from an Objective-C programmer
Some of those who know me will know I am a fan of Objective-C, which is -- very loosely -- a kind of hybrid of Smalltalk and C. I have not had the opportunity of programming in Smalltalk, so I will adress those points which can be related to what Objective-C can offer.

Objective-C is dynamically typed, but it also permits static typing. This is a very handy feature. Consider your square example. In Objective-C, since the C primitive type int is not a first class object, you could define a square function within a class thus - (int) square: (int) x or if you had some wrapper class - (Integer *) square: (Integer *) x

As you have specified a concrete class name, Integer, the compiler applies strong typing methodology. Alternatively, you could use dynamic typing, for example - (id) doSomething: (id) x where id is a class identifier (which one can treat like a "generic" class).

The point about doesNotUnderstand is a little bit of a technicality, in my opinion, since the Objective-C runtime as far as I recall does not "expose" any inner workings of the program. The fact that "doesNotUnderstand" is "obscure" is reaching a little - this has perfect and precise meaning to those who know the system. Regardless, Objective-C will let you override the doesNotUnderstand method and produce a more explicit message, if one is so inclined.

I encourage you to look at Objective-C. It offers you some capabilities and dynamism that is unparalleled across other languages. Dysprosia 14:26, 13 Apr 2005 (UTC)


 * I perfectly understand the semantics of doesNotUnderstand and the fact that you can override it. My point is that, unless you write elaborate dirty typechecking code, passing an illegal object as parameter will almost always break a method's contract. Wouter Lievens 14:41, 13 Apr 2005 (UTC)


 * Ok. However, Objective-C lets you defend against the "elaborate dirty typechecking". Objective-C offers you a construct identical to Java's interface, known as (a better name IMO) a protocol. This enables you to specify an object identifier (a generic object), but one that must conform to a specific protocol. For example, say I want to lock an element, which conforms to the protocol Lockable below

@protocol Lockable - (id) lock: (id); - (id) unlock: (id); @end and a specific method, for example - (id ) update: (id ) object {  [object lock]; //won't stuff up, as we've specified object *must* have a                  // lock method available [object sync]; [object unlock];

return object; }
 * Dysprosia 22:47, 13 Apr 2005 (UTC)


 * And how is what you described here different from (hybrid) static typing? As far as I know, languages such as Smalltalk and Python do not support this. Wouter Lievens 13:10, 1 May 2005 (UTC)


 * I don't quite understand what you're trying to say here. Hybrid dynamic/static typing gives you the best of both worlds: you get all the benefits of dynamic typing where you need/want it, and where you need/want static typing you can do it without having to do runtime typechecking, and where you want dynamic typing and need some checking enforced, you can use protocols to enforce it.
 * Where normally in something like C++ this would be achieved by abstract base classes, the use of protocols in this circumstance makes the inheritance tree much cleaner and simpler when you're trying to apply the Lockable protocol across disparate or unrelated classes. Of course, overall, the two methods are equivalent, but IMO the way Objective-C implements it is superior, plus you get nice things like categories and forwarding in the language. Dysprosia 04:52, 3 May 2005 (UTC)
 * I'll rephrase: the feature you described here (the protocol annotations on parameters) is something I do like. It eliminates many of the problems I listed in my article. However, it is not a feature in most dynamically typed languages (Smalltalk, Python, ...) and as such it doesn't change the validity of the points raised in my article. Wouter Lievens 12:50, 19 May 2005 (UTC)