[fpc-devel] String constants to ObjC types

Jonas Maebe jonas at freepascal.org
Sat Apr 21 13:09:03 CEST 2018

On 20/04/18 02:59, Dmitry Boyarintsev wrote:
> The documentation: http://wiki.freepascal.org/FPC_PasCocoa
> suggests to use compiler built-in function ObjCSelector.
> I presume this turns the selector into a constant, thus has no impact on 
> the runtime.
> However, how hard would it be to make the compiler itself to implicitly 
> convert a string constant to a objc selector?

This is not about being hard or not, but about strong typing. And even 
in Objective-C itself there is no implicit conversion.

> As well as a constant string to a constant objective-C string (without 
> using NSSTR())?

It's been on the todo list since forever: 

It needs a syntax and then implementation. I don't think the 
implementation would be very hard, but not trivial either. It would also 
require some research to determine whether it's the same on all 
architectures and for the Objective-C 1.0 and 2.0+ runtimes.


More information about the fpc-devel mailing list