On Jun 20, 2007, at 8:19 AM, Dirk Stegemann (Mailing-Lists) wrote:
Hello,
Am 20.06.2007 um 14:20 schrieb Philip Aker:
On 2007-06-20, at 01:02:05, Mike Conley wrote:
And as long as I'm on the subject of those tagged parameters,
what in hell is the point of those, anyway?
Amongst other things, it's the method signature -- which I think
is a part of how the language knows which selector to target.
Only the number of method parameters matters as becomes obvious
when creating an SEL reference (which you would want to use, e.g.
to call the selector manually).
To obtain selectors (SEL) to those methods, you'd write in code:
SEL selector1 = @selector(justAMethod:);
SEL selector2 = @selector(justAMethod::);
SEL selector3 = @selector(anotherMethod::);
Except that this is wrong.
You want:
SEL selector1 = @selector(justAMethod:)
SEL selector2 = @selector(justAMethod:anotherArgument:)
SEL selector3 = @selector(anotherMethod:anotherArgument:)
Therefore, you wouldn't be able to distinguish between
SEL selector4 = @selector(justAMethod::);
SEL selector5 = @selector(justAMethod::);
SEL selector4 = @selector(justAMethod:argVariant1:)
SEL selector5 = @selector(justAMethod:argVariant2:)
and there is no problem.
The important point is that Objective C does not have tagged/named
parameters. The method name is just "interwoven" with the parameters.
The fact that a method selector can be assigned to a variable (or
even generated from a string) and then later used to send the
corresponding message to a receiver is the power of dynamic dispatch
(in C++ you can sort of use a member function pointer, but that is
only valid for a given class + subclasses, and can't be used in a
combination with another object that has the same signature but is
from a independent class hierarchy)
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures,
fractals, art
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden