• 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: What is the purpose of static typing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the purpose of static typing?


  • Subject: Re: What is the purpose of static typing?
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 25 Jul 2002 16:51:52 +0200

On Thursday, July 25, 2002, at 02:13 , Philip George wrote:

I realize this is a rather crude benchmark, but it still illustrates my
point: extra time is required to handle dynamically-typed objects at
runtime.

There's no point in trying to make a perpetuum mobile or contact E.T., whatever hard you try.

In the same way, there's no point in trying to prove that there's any runtime difference between static and dynamic typing, for there is none. You are just wrong, as are your benchmarks. The simplest proof is checking the generated code: it's exactly the same in both cases:

186 /tmp> cat q.m
#import <Foundation/Foundation.h>
int main() {
id o;
NSString *s;
[o length];
[s length];
return 0;
}
187 /tmp> cc -framework Foundation q.m -S
cc: -framework: linker input file unused since linking not done
cc: Foundation: linker input file unused since linking not done
188 /tmp> cat q.s
...
L1$pb:
mflr r31
lwz r29,56(r30)
addis r9,r31,ha16(L_OBJC_SELECTOR_REFERENCES_0-L1$pb)
la r9,lo16(L_OBJC_SELECTOR_REFERENCES_0-L1$pb)(r9)
mr r3,r29
lwz r4,0(r9)
bl L_objc_msgSend$stub
lwz r28,60(r30)
addis r9,r31,ha16(L_OBJC_SELECTOR_REFERENCES_0-L1$pb)
la r9,lo16(L_OBJC_SELECTOR_REFERENCES_0-L1$pb)(r9)
mr r3,r28
lwz r4,0(r9)
bl L_objc_msgSend$stub
li r3,0
...
189 /tmp>

So, please, do stop this nonsense.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: What is the purpose of static typing? (From: Philip George <email@hidden>)

  • Prev by Date: Re: What is the purpose of static typing?
  • Next by Date: Re: double click call textedit
  • Previous by thread: Re: What is the purpose of static typing?
  • Next by thread: Re: What is the purpose of static typing?
  • Index(es):
    • Date
    • Thread