[swift-evolution] [Mini-proposal] Require @nonobjc on members of @objc protocol extensions
Félix Cloutier
felixcca at yahoo.ca
Tue Jan 5 21:20:34 CST 2016
I stand corrected.
Félix
> Le 5 janv. 2016 à 22:19:28, Charles Srstka <cocoadev at charlessoft.com> a écrit :
>
>> On Jan 5, 2016, at 9:06 PM, Félix Cloutier <felixcca at yahoo.ca <mailto:felixcca at yahoo.ca>> wrote:
>>
>> The linker is smart enough to get rid of frameworks that you don't actually use.
>>
>> Félix
>
>
> objc_copyClassList leaves a value of 14694 in classCount. When I just link against Foundation it only gives 1581.
>
> otool says:
>
> $ otool -L test
> test:
> /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1256.1.0)
> /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork (compatibility version 1.0.0, current version 760.2.5)
> /System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/Contacts.framework/Versions/A/Contacts (compatibility version 0.0.0, current version 0.0.0)
> /System/Library/Frameworks/GSS.framework/Versions/A/GSS (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreMIDIServer.framework/Versions/A/CoreMIDIServer (compatibility version 1.0.0, current version 73.0.0)
> /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.10)
> /System/Library/Frameworks/CoreLocation.framework/Versions/A/CoreLocation (compatibility version 1.0.0, current version 1615.38.0)
> /System/Library/Frameworks/GLKit.framework/Versions/A/GLKit (compatibility version 1.0.0, current version 20.0.0)
> /System/Library/Frameworks/MapKit.framework/Versions/A/MapKit (compatibility version 1.0.0, current version 0.0.0)
> /System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement (compatibility version 1.0.0, current version 756.20.4)
> /System/Library/Frameworks/CoreTelephony.framework/Versions/A/CoreTelephony (compatibility version 1.0.0, current version 0.0.0)
> /System/Library/Frameworks/CloudKit.framework/Versions/A/CloudKit (compatibility version 1.0.0, current version 481.8.0)
> /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/Collaboration.framework/Versions/A/Collaboration (compatibility version 1.0.0, current version 75.0.0)
> /System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.4.0)
> /System/Library/Frameworks/AddressBook.framework/Versions/A/AddressBook (compatibility version 1.0.0, current version 1679.3.0)
> /System/Library/Frameworks/QuickLook.framework/Versions/A/QuickLook (compatibility version 1.0.0, current version 0.0.0)
> /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility version 8.5.0, current version 8.5.9)
> /System/Library/Frameworks/DiscRecording.framework/Versions/A/DiscRecording (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/InputMethodKit.framework/Versions/A/InputMethodKit (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/Photos.framework/Versions/A/Photos (compatibility version 1.0.0, current version 350.22.0)
> /System/Library/Frameworks/OSAKit.framework/Versions/A/OSAKit (compatibility version 1.0.0, current version 104.0.0)
> /System/Library/Frameworks/MediaAccessibility.framework/Versions/A/MediaAccessibility (compatibility version 1.0.0, current version 62.0.0)
> /System/Library/Frameworks/ContactsUI.framework/Versions/A/ContactsUI (compatibility version 1.0.0, current version 1679.3.0)
> /System/Library/Frameworks/DirectoryService.framework/Versions/A/DirectoryService (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/StoreKit.framework/Versions/A/StoreKit (compatibility version 1.0.0, current version 379.0.0)
> /System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/PreferencePanes.framework/Versions/A/PreferencePanes (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/GameplayKit.framework/Versions/A/GameplayKit (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/SyncServices.framework/Versions/A/SyncServices (compatibility version 48.0.0, current version 724.0.0)
> /System/Library/Frameworks/AVKit.framework/Versions/A/AVKit (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/GLUT.framework/Versions/A/GLUT (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/GameController.framework/Versions/A/GameController (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility version 8.5.0, current version 8.5.9)
> /System/Library/Frameworks/AppleScriptObjC.framework/Versions/A/AppleScriptObjC (compatibility version 1.0.0, current version 32.0.0)
> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1404.32.0)
> /System/Library/Frameworks/InstallerPlugins.framework/Versions/A/InstallerPlugins (compatibility version 1.0.0, current version 815.0.0)
> /System/Library/Frameworks/SecurityFoundation.framework/Versions/A/SecurityFoundation (compatibility version 1.0.0, current version 55126.0.0)
> /System/Library/Frameworks/ImageCaptureCore.framework/Versions/A/ImageCaptureCore (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/VideoDecodeAcceleration.framework/Versions/A/VideoDecodeAcceleration (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 600.0.0)
> /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos (compatibility version 5.0.0, current version 6.0.0)
> /System/Library/Frameworks/vmnet.framework/Versions/A/vmnet (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/Quartz.framework/Versions/A/Quartz (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData (compatibility version 1.0.0, current version 641.3.0)
> /System/Library/Frameworks/IMServicePlugIn.framework/Versions/A/IMServicePlugIn (compatibility version 1.0.0, current version 1000.0.0)
> /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/JavaScriptCore (compatibility version 1.0.0, current version 601.3.7)
> /System/Library/Frameworks/NotificationCenter.framework/Versions/A/NotificationCenter (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/LocalAuthentication.framework/Versions/A/LocalAuthentication (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/GameKit.framework/Versions/A/GameKit (compatibility version 1.0.0, current version 365.103.0)
> /System/Library/Frameworks/PubSub.framework/Versions/A/PubSub (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreMediaIO.framework/Versions/A/CoreMediaIO (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/Social.framework/Versions/A/Social (compatibility version 1.0.0, current version 538.0.0)
> /System/Library/Frameworks/MultipeerConnectivity.framework/Versions/A/MultipeerConnectivity (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.5.0)
> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
> /System/Library/Frameworks/QTKit.framework/Versions/A/QTKit (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0)
> /System/Library/Frameworks/NetworkExtension.framework/Versions/A/NetworkExtension (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/PCSC.framework/Versions/A/PCSC (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/ExceptionHandling.framework/Versions/A/ExceptionHandling (compatibility version 1.0.0, current version 11.0.0)
> /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
> /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57337.20.43)
> /System/Library/Frameworks/AppleScriptKit.framework/Versions/A/AppleScriptKit (compatibility version 1.0.0, current version 83.0.0)
> /System/Library/Frameworks/LatentSemanticMapping.framework/Versions/A/LatentSemanticMapping (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib (compatibility version 2.0.0, current version 2.0.0)
> /System/Library/Frameworks/InstantMessage.framework/Versions/A/InstantMessage (compatibility version 1.0.0, current version 800.0.0)
> /System/Library/Frameworks/AudioVideoBridging.framework/Versions/A/AudioVideoBridging (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage (compatibility version 1.0.1, current version 2.0.0)
> /System/Library/Frameworks/Automator.framework/Versions/A/Automator (compatibility version 1.0.0, current version 0.0.0)
> /System/Library/Frameworks/MetalKit.framework/Versions/A/MetalKit (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/Hypervisor.framework/Versions/A/Hypervisor (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/SceneKit.framework/Versions/A/SceneKit (compatibility version 1.0.0, current version 186.0.0)
> /System/Library/Frameworks/OpenAL.framework/Versions/A/OpenAL (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/EventKit.framework/Versions/A/EventKit (compatibility version 1.0.0, current version 487.3.0)
> /System/Library/Frameworks/CoreBluetooth.framework/Versions/A/CoreBluetooth (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/IOBluetoothUI.framework/Versions/A/IOBluetoothUI (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CalendarStore.framework/Versions/A/CalendarStore (compatibility version 1.0.0, current version 1501.0.0)
> /System/Library/Frameworks/SpriteKit.framework/Versions/A/SpriteKit (compatibility version 1.0.0, current version 2.0.0)
> /System/Library/Frameworks/VideoToolbox.framework/Versions/A/VideoToolbox (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 492.0.0)
> /System/Library/Frameworks/ForceFeedback.framework/Versions/A/ForceFeedback (compatibility version 1.0.0, current version 1.0.2)
> /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS (compatibility version 1.0.0, current version 1.0.0)
> @rpath/FinderSync.framework/Versions/A/FinderSync (compatibility version 1.0.0, current version 960.2.6)
> /System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 601.3.9)
> /System/Library/Frameworks/TWAIN.framework/Versions/A/TWAIN (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/SecurityInterface.framework/Versions/A/SecurityInterface (compatibility version 1.0.0, current version 55065.20.1)
> /System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreMIDI.framework/Versions/A/CoreMIDI (compatibility version 1.0.0, current version 73.0.0)
> /System/Library/Frameworks/ICADevices.framework/Versions/A/ICADevices (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/MediaToolbox.framework/Versions/A/MediaToolbox (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreAudioKit.framework/Versions/A/CoreAudioKit (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/Accounts.framework/Versions/A/Accounts (compatibility version 1.0.0, current version 0.0.0)
> /System/Library/Frameworks/PhotosUI.framework/Versions/A/PhotosUI (compatibility version 1.0.0, current version 350.22.0)
> /System/Library/Frameworks/DVDPlayback.framework/Versions/A/DVDPlayback (compatibility version 5000.0.0, current version 5950.0.0)
> /System/Library/Frameworks/DiscRecordingUI.framework/Versions/A/DiscRecordingUI (compatibility version 1.0.0, current version 1.0.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
> /System/Library/Frameworks/ScriptingBridge.framework/Versions/A/ScriptingBridge (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreWLAN.framework/Versions/A/CoreWLAN (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CryptoTokenKit.framework/Versions/A/CryptoTokenKit (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/ScreenSaver.framework/Versions/A/ScreenSaver (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 22.0.0)
> /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0)
> /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 728.6.0)
> /System/Library/Frameworks/MediaLibrary.framework/Versions/A/MediaLibrary (compatibility version 1.0.0, current version 721.0.0)
> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1256.14.0)
> /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
> /System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, current version 2.0.0)
> /System/Library/Frameworks/FWAUserLib.framework/Versions/A/FWAUserLib (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface (compatibility version 1.0.0, current version 1.0.0)
> /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 802.20.7)
> /System/Library/Frameworks/IOBluetooth.framework/Versions/A/IOBluetooth (compatibility version 1.0.0, current version 1.0.0)
> /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
>
> I don't think the optimization you describe is possible with Objective-C due to the dynamic nature of the runtime. The linker has no way of knowing that a class won’t be accessed via NSClassFromString(), or from a nib file or something.
>
> Charles
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160105/d77d18c1/attachment.html>
More information about the swift-evolution
mailing list