Re: Instance Variable access
Re: Instance Variable access
- Subject: Re: Instance Variable access
- From: Ondra Cada <email@hidden>
- Date: Sat, 8 May 2004 19:01:42 +0200
Allan,
On 8.5.2004, at 18:16, Allan Odgaard wrote:
>
ObjectiveC uses the actual name of the method as signature/identifier.
>
When it needs to call a method it computes a hash from the name,
>
looks into a hash-table to see if a match is found, and if not, it
>
finds the method using the isa pointer (traversing linked lists of
>
method names), and then updates the hash.
Not quite. The general principle is right, but there's no hashing and
no using the actual name (that's what Java does). Instead, the message
(not method!) names are link-time converted to *selectors*, which are
numbers (pointers, that's the same in C).
Although selectors are equal to message names in the sense there is a
unique translation (you can find a selector for a given string / you
can find a string name for a given selector), the efficiency benefit of
using numbers instead names internally is *vast*.
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.