5 ms·
> Objective-C is a dynamic OO language Objective C is not a dynamic language. Do not confuse dynamic language with dynamic typing or whatever the standard wis
by ris 13y ago
> Objective-C is a dynamic OO language
Objective C is not a dynamic language.
Do not confuse dynamic language with dynamic typing or whatever the standard wisdom in the Apple cult is.
- Alphasite_ 13y agoI'd certainly say that it is, it certainly meets the dynamic binding pre requisite. And small talk certainly does, so why does Objective-C not qualify?
- pjmlp 13y agoBecause of the C subset.
- strmpnk 13y agoMany languages have static subsets. For example, many languages won't let you change the meaning of `1+1` while others might allow you to dispatch the addition dynamically.
- KMag 13y agoIn fact, a static subset is a very nice property to have in a dynamic language. It's probably the easiest way to make a dynamic language self-hosting. For instance, PyPy uses a static subset of Python called RPython and Squeak uses a subset of Smalltalk called Slang.
- mpweiher 13y agoSure is. Supported: Dynamic typing. Fully dynamic message dispatch with doesNotUnderstand: (called forwardInvocation:), proxies, Higher Order Messaging, etc. Addition of (a) classes ( objc_registerClassPair() ) and (b) methods ( class_addMethod() ) at runtime. Changing an object's class at runtime (objc_setClass() slightly hacky, but done by system services such as KVO, so supported). Closures/Blocks. Reflection. Addition of (associated) instance variables at runtime. Interpreted languages can be fully interoperable peers. Not supported: Eval (but see above re: interpreted peers). Continuations. ---- See: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html#//apple_ref/c/func/object_setClass https://developer.apple.com/library/mac/documentation/Cocoa/... EDIT: added references.
- ris 13y ago> Addition of (a) classes (b) methods at runtime. This is news to me.
- mpweiher 13y agoAlways glad to help you learn new stuff :-)
- pjmlp 13y agoHow do you dynamically? - add fields to a struct - create a function Objective-C is only dynamic typed in the OO runtime, everything else is static typed. Dynamic languages are 100% dynamic, unless the CS classification got changed in the last years.
- mpweiher 13y agoThat's just silly. By that definition, Smalltalk is not a dynamic language: you cannot change the definition of assignment ( := ), message return ( ^ ) or the messenger itself. You also cannot change the the way the GC works.
- pjmlp 13y ago> That's just silly. No it is not. I can do that in fully dynamic languages like TCL and Python, for example.