• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa and the need for a dynamic language
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa and the need for a dynamic language


  • Subject: Re: Cocoa and the need for a dynamic language
  • From: Ian Joyner <email@hidden>
  • Date: Sun, 18 Jan 2009 22:04:10 +1100

On 18/01/2009, at 1:51 PM, Erik Buck wrote:

Both Objective-C message sending and C++ virtual function calls commonly prevent in-lining because the _compiler_ can not determine which code will actually be called. If you use Objective-C message sending or C++ virtual member functions, you forego most low level optimizations at the call sites.

Nicely stated. Presumably, one is using a dynamic method because you are having to defer to runtime exactly what code will be executed. If you did not have dynamic method dispatch, you would have to explicitly write the decision mechanism in the code yourself (conditionals or case statements). That is, the complexity does not go away – it may be that the complexity of the method dispatch has to be explicitly coded. A recent article on computer architecture states this "complexity preservation principle" rather clearly:


http://www.embedded.com/columns/technicalinsights/29111964?_requestid=1581

Now in Objective-C, the compiler (or linker) can't do static analysis to remove unnecessary method dispatches because your system is effectively open (dynamic) to have various add ins (categories, etc) that can happen at runtime. If a system is closed (as with Eiffel), a compiler can be much more ruthless in its optimization attempts, but of course you lose the ability to dynamically add functionality. With C ++, the complexity is to a very large extent left inelegantly up to the coder. Many programmers seem to feel safer that way.

Ian_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Cocoa and the need for a dynamic language (From: Erik Buck <email@hidden>)

  • Prev by Date: Re: Create App both for Tiger and Leopard
  • Next by Date: Re: Create App both for Tiger and Leopard
  • Previous by thread: Cocoa and the need for a dynamic language
  • Next by thread: Re: Cocoa and the need for a dynamic language
  • Index(es):
    • Date
    • Thread