DMD/Objective-C Alpha 1

Michel Fortin michel.fortin at michelf.com
Thu Jun 2 07:23:39 PDT 2011


On 2011-06-02 09:58:06 -0400, bearophile <bearophileHUGS at lycos.com> said:

> Michel Fortin:
> 
>> That said, if Walter doesn't like it I could change it to a more
>> "standard" pragma syntax:
>> 
>> pragma(objc_selector, "insertIdemWithObjectValue:atIndex:")
>> void insertItem(ObjcObject object, NSInteger value);
>> 
>> It's more verbose and less readable, but it'd work too.
> 
> Another possible syntax, using ddoc:
> 
> /// This is a selector for...
> void insertItem(ObjcObject object, NSInteger value); /// 
> insertItemWithObjectValue:atIndex:

Actually, that's not a very good idea because the selector is not 
documentation. The compiler cannot ignore it.

With the Objective-C runtime, each function has a selector matching its 
actual Objective-C method name. The selector is what the compiler uses 
to call the function dynamically. The method name shouldn't be stripped 
like it was a comment or some documentation because that'll change and 
likely break the program.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d-announce mailing list