[fpc-devel] String constants to ObjC types
Dmitry Boyarintsev
skalogryz.lists at gmail.com
Fri Apr 20 02:59:39 CEST 2018
Hello,
It's somewhat common task to convert a constant string to a selector.
On Thu, Apr 19, 2018 at 8:43 PM, Dmitry Boyarintsev <
skalogryz.lists at gmail.com> wrote:
>
> respondToSelector instance method
> https://developer.apple.com/documentation/objectivec/
> 1418956-nsobject/1418583-respondstoselector?language=objc
>
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?
As well as a constant string to a constant objective-C string (without
using NSSTR())?
ObjC itself introduced @'...' syntax. (Due to C-syntax ambiguity?)
Does similar ambiguity exist for Pascal syntax?
It doesn't seem to have any problems to implicitly convert constant strings
to pchars, array of chars, ansistring, widestrings, OLEStrings - which is
similar to NSStrings a platform specific string.
thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180419/a502b0af/attachment.html>
More information about the fpc-devel
mailing list