• 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 dead-code stripping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa and dead-code stripping


  • Subject: Re: Cocoa and dead-code stripping
  • From: "Clark Cox" <email@hidden>
  • Date: Tue, 3 Jul 2007 10:04:55 -0700

On 7/3/07, Andrew Demkin <email@hidden> wrote:

On Jul 3, 2007, at 7:50 AM, Clark Cox wrote:

> On 7/2/07, Andrew Demkin <email@hidden> wrote:
>>
>> On Jul 2, 2007, at 8:28 PM, Wade Tregaskis wrote:
>>
>> >> The way this would work is to have the development tools scan all
>> >> message selector references (and class literal references) and
>> >> strip all methods and classes that aren't referenced. This process
>> >> would repeat until the tool can no longer perform any more
>> stripping.
>> >
>> > O rly?
>> >
>> > .h
>> > IBOutlet id myTextField;
>> >
>> > .m
>> > NSString *selectorName = [myTextField stringValue];
>> > SEL newSelector = NSSelectorFromString(selectorName);
>> > [myObject performSelector:newSelector];
>>
>> Yes, this is exactly the sort of example which I tried to cover in my
>> original posting when I said,
>>
>>      Of course, there's still the probability that some references
>>      won't be known at compile-time, and for these methods and
>> classes,
>>      a tagging technique would be necessary to suppress the
>> stripping.
>
> Tagging would not work, as *any* method can be called dynamically at
> runtime. You'd have to tag every single method--which would defeat the
> purpose.

In this specific case, perhaps the best thing to do would be to
disable the hypothetical automatic stripping. So what? That doesn't
mean that stripping wouldn't work for more common cases.

The problem is that this specific case *is* the common case. You'd have to disable this hypothetical automatic stripping for every Cocoa program. In which case, what was the point in making such a stripping program in the first place?

Let me put it another way. Forget Objective-C. This example would be
no different than having a C-based program that allows a user to
input strings. Then, the program could turn around and use CFBundle
APIs to resolve C functions to invoke. Does that mean that automatic
code stripping is not possible for C code, or that it's not useful?
Of course not.

The difference is that calling C functions in this manner is the exception, while calling ObjC methods in this manner is the rule.

--
Clark S. Cox III
email@hidden
_______________________________________________

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


  • Follow-Ups:
    • Re: Cocoa and dead-code stripping
      • From: Andrew Demkin <email@hidden>
References: 
 >Cocoa and dead-code stripping (From: Steve Christensen <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: Steve Christensen <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: Uli Kusterer <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: Steve Christensen <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: Chris Hanson <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: Andrew Demkin <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: Wade Tregaskis <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: Andrew Demkin <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: "Clark Cox" <email@hidden>)
 >Re: Cocoa and dead-code stripping (From: Andrew Demkin <email@hidden>)

  • Prev by Date: Re: Cocoa and dead-code stripping
  • Next by Date: Re: Memory Management Question
  • Previous by thread: Re: Cocoa and dead-code stripping
  • Next by thread: Re: Cocoa and dead-code stripping
  • Index(es):
    • Date
    • Thread