proposal for better syntax for extern objective-C and compatibility with named argument parameters

Jacob Carlborg doob at me.com
Thu Jun 27 04:54:29 PDT 2013


On 2013-06-27 07:35, Timothee Cour wrote:
> See [1][2] for related thread introducing extern(objective C)
>
> A)
> The syntax proposed in [2] transforms:
> -(void) insertItemWithObjectValue: (NSString *) path atGreen:(NSInteger)
> anInt;
> [obj insertItemWithObjectValue:val atGreen:idx ];
>
> into:
> void insertItem(NSString* object, NSInteger anInt)
> [insertItemWithObjectValue:atGreen:];
> obj.insertItem(val, idx);
>
> B)
> I don't see how it handles this case:
> [obj insertItemWithObjectValue:val atGreen:idx ];
> [obj insertItemWithObjectValue:val atRed:idx ];
>
> obj.insertItem(val, idx); //atGreen or atRed ?

In my binding generator (DStep) I just use the whole selector name and 
replaces colons with underscores. This doesn't happen that often.

> F)
> *I'd like to propose instead the following syntax:*
> void insertItemWithObjectValue(NSString* object, NSInteger atGreen:);
> void insertItemWithObjectValue(NSString* object, NSInteger atRed:);

I think this looks a bit weird.

> obj. insertItemWithObjectValue(object, atGreen: idx);
> obj. insertItemWithObjectValue(object, atRed: idx);

Actually, I wouldn't mind this.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list