On Friday, July 5, 2002, at 03:50 PM, bob ackerman wrote:
>> In general, Objective-C method calls of the form:
>> [object method: arg1 arg2Name: arg2];
>>
>> Are called in Perl like this:
>> $object->method_arg2Name(arg1, arg2);
>>
>> The argument names are concatenated with the method name, and ':' are
>> turned into '_'s. If there is a trailing '_', as there would be for a
>> method that took only one argument, it is removed from the Perl
>> equivalent.
>>
>> For example, to create a mutable dictionary with an initial capacity
>> for five objects, and add a single string object in Objective-C looks
>> like this:
>>
>> NSMutableDictionary *dict;
>> dict = [[NSMutableDictionary alloc] initWithCapacity: 5];
>> [dict setObject: @"This is a string" forKey: @"This is the key"];
>>
>> The equivalent in Perl would look like this:
>>
>> our $dict;
>> $dict = NSMutableDictionary->alloc->initWithCapacity(5);
>> $dict->setObject_forKey("This is a string", "This is the key");
>>
>> Does that help clear it up any, or just muddy it further?
>
> have seen it, or is every camelbones user going to want to know this
> stuff?
Funny you should ask that... The above is about the clearest explanation
I've been able to write about calling Objective-C methods from Perl, and
I was just saying to myself that maybe it should be part of the docs.
sherm--