FROM : Erik Buck
DATE : Sat Jul 08 02:50:16 2006
The key and absolute central feature of Objective-C is that you can
send any message to any object any time. This is sometimes called
"Duck" typing. (http://en.wikipedia.org/wiki/Duck_typing) There is
a very nice article on typing systems including a large comparison
table at http://en.wikipedia.org/wiki/
Dynamic_typing#Static_and_dynamic_type_checking_in_practice.
Static/strong typing would presumably tell you at compile time or
possibly even at run-time that you can't send some messages to some
objects thus violating the key/central feature of the language.
Consider the following features of Cocoa and other frameworks that
explicitly rely on being able to send any message to any object any
time: (features in no particular order)
1) Distributed objects: Ref NSProxy and message forwarding
2) CoreData: Ref "faulting"
3) Key/Value/(Coding|Observing)
4) Target/Action and the Responder Chain: Ref -sendAction:to:from:
5) Anyplace you encounter the id data type
6) -makeObjectsPerformSelector:withObject:
7) F-Script: Ref http://www.fscript.org/
8) Cocoa's undo system
9) Simple or implicit implementation GOF Design Patterns: Ref http://
home.earthlink.net/~huston2/dp/patterns.html
Feel free to "improve" Objective-C, but I doubt anyone would call
your new language Objective-C. If you appreciate the strengths of
Cocoa and other Objective-C frameworks and/or the body of Smalltalk
in the world, please recognize that the improvements you suggest
would make the frameworks impossible or unwieldy to build in the
first place.
> One such example is the NSArray foundation class. I would like to be
> able to express that I specifically have an NSArray containing only
> objects of a certain type. This would allow me to (a) let the
Just out of curiosity, why do you want this ? How often do you put
the wrong kind of object in a collection in practice ? What
determines "wrong" ? Do you have some objection to -
respondsToSelector: in cases when you can't know in advance what
objects might be in a collection that was provided to your code ?
DATE : Sat Jul 08 02:50:16 2006
The key and absolute central feature of Objective-C is that you can
send any message to any object any time. This is sometimes called
"Duck" typing. (http://en.wikipedia.org/wiki/Duck_typing) There is
a very nice article on typing systems including a large comparison
table at http://en.wikipedia.org/wiki/
Dynamic_typing#Static_and_dynamic_type_checking_in_practice.
Static/strong typing would presumably tell you at compile time or
possibly even at run-time that you can't send some messages to some
objects thus violating the key/central feature of the language.
Consider the following features of Cocoa and other frameworks that
explicitly rely on being able to send any message to any object any
time: (features in no particular order)
1) Distributed objects: Ref NSProxy and message forwarding
2) CoreData: Ref "faulting"
3) Key/Value/(Coding|Observing)
4) Target/Action and the Responder Chain: Ref -sendAction:to:from:
5) Anyplace you encounter the id data type
6) -makeObjectsPerformSelector:withObject:
7) F-Script: Ref http://www.fscript.org/
8) Cocoa's undo system
9) Simple or implicit implementation GOF Design Patterns: Ref http://
home.earthlink.net/~huston2/dp/patterns.html
Feel free to "improve" Objective-C, but I doubt anyone would call
your new language Objective-C. If you appreciate the strengths of
Cocoa and other Objective-C frameworks and/or the body of Smalltalk
in the world, please recognize that the improvements you suggest
would make the frameworks impossible or unwieldy to build in the
first place.
> One such example is the NSArray foundation class. I would like to be
> able to express that I specifically have an NSArray containing only
> objects of a certain type. This would allow me to (a) let the
Just out of curiosity, why do you want this ? How often do you put
the wrong kind of object in a collection in practice ? What
determines "wrong" ? Do you have some objection to -
respondsToSelector: in cases when you can't know in advance what
objects might be in a collection that was provided to your code ?






Cocoa mail archive

