On 2010-11-04 13:08, Michel Fortin wrote:
On 2010-11-04 07:37:25 -0400, Kagamin <[email protected]> said:

Do you require explicit selector declaration? I'm afraid, this will
lead to a large duplication:

extern (Objective-C)
class NSComboBox : NSTextField
{
private void* _dataSource;

void insertItemWithObjectValue(ObjcObject object, NSInteger atIndex)
[insertItemWithObjectValue:atIndex:];
void insertItemWithObjectValue(ObjcObject object)
[insertItemWithObjectValue:];
}

comboBox.insertItemWithObjectValue(val, idx); // [comboBox
insertItemWithObjectValue:val atIndex:idx]
comboBox.insertItemWithObjectValue(val); // [comboBox
insertItemWithObjectValue:val]

compiler can build selector automatically from function signature.

More or less. You need to specify the selector explicitly only if you
need the function to have specific selector. Otherwise the compiler will
generate one for you.

The compiler-generated selector will ensure that function overloading
works by adding the mangled parameter types. As an exception for
@property setters, the compiler will convert function 'name' to selector
'setName:' which should make properties work with key-value coding. For
@IBAction functions, it'll use directly the name of the function.

So you should rarely have to specify the selector unless you're writing
bindings to existing Objective-C objects. And, hopefully, creating
bindings can be automated.

I already have a Ruby script/tool that automatically creates Objective-C bindings. But these bindings are not optimal (require some manual editing), it would also require to update the script for this syntax.

But now I've stared on a new tool based on Clang that creates Objective-C bindings and it's working A LOT better then the Ruby script. Having the tool based on a complete frontend is a HUGE improvement and makes the development processes easier.

--
/Jacob Carlborg

Reply via email to