On 2010-11-04 04:14:41 -0400, Anders F Björklund <[email protected]> said:

Michel Fortin wrote:
But the issue isn't the underscore, it's the verbosity of Objective-C
method names. Method names in Objective-C tend to be long and
expressive, they are meant to have the arguments interleaved between
each part of the selector. This interleaving makes Objective-C code very
natural to read. Remove that and you've got something that doesn't read
well and on top of that looks out of place in a D program.

The JavaBridge had lots of those functions, while it was alive:

http://developer.apple.com/legacy/mac/library/documentation/Cocoa/Conceptual/Legacy/JavaBridge/JavaBridge.pdf

-(void)setObject:(id)anObject

forKey:(id)aKey;

void setObjectForKey(Object anObject, Object aKey);

Well, if you read closely that document, you'll see that they map Java function names to selectors manually too. The Java classes are generated from .jobs files, and in a .jobs file you'll find mapping for selectors:

"""
selector
Specifies any non-default mappings between Objective-C selectors and Java method names. (The default is to use the Objective-C name before the colon as the Java name.) These mappings apply to all classes. Note: Put all of the mappings under a single selector specification.

selector
        -defineClass:withName: = defineClassWithName
        -pathForResource:ofType: = pathForResourceType
"""

I think a similar approach should be taken for tools that create bindings. Which means that by default it picks the first part of the selector as the function's name, but if you defined a custom mapping then it'll use that instead.


--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to