[fpc-devel] ObjC branch

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Sep 12 18:21:59 CEST 2009


On 12 Sep 2009, at 18:00, dmitry boyarintsev wrote:

> Do understand things right? Delphi  (.net?) class helpers are very
> close to objective-C categories, for the expection, that helpers can
> also add additional members and properties.

Can they really add new fields? (I guess that's what you mean by  
"members") The page you referenced only talked about methods and  
properties.

> While categories are
> allowed to add new methods only?

It can also override existing ones.

> But still, if the fp compiler is to "catch up" with newer Delphi,
> should Obj-C branch use the similiar syntax?!
>
> NSSomeCategory = objcclass for NSObject
> end;

I think it would actually be:

NSSomeCategory = objcclass helper for NSObject
end;

> imho, the following code looks much better:
>
> NSSomeCategory = objccategory (NSObject)

I really don't have a strong opinion. I propose we go with  
"objccategory" for now, and if support for class helpers is added one  
day then we can always still allow that syntax for categories (there  
will be no backwards compatibilities with allowing that).

As Marco mentioned, categories are different though. For example, a  
category can override a method of a class (and then it does so for  
every class instance of that type in existence, including derived  
ones), while a class helper cannot do that. A class helper is indeed  
just a syntactic extension (as mentioned on the web page, mainly to be  
used for cleanly implementing some low level language/rtl support).


Jonas



More information about the fpc-devel mailing list