[fpc-devel] What's the status of Maciej's Smart Pointer enhancements?

Anthony Walter sysrpl at gmail.com
Sun Apr 29 21:26:16 CEST 2018

Here is a video overview of this message

I've run into an almost must have use case for FPC smart pointers as
described and implemented by Maciej. I wanted to know from the people who
make decision about what to merge, what's the status of rolling his
enhancements at following location into FPC trunk?

svn ls https://svn.freepascal.org/svn/fpc/branches/maciej/smart_pointers/

My use case is for adding a free pascal interface to Webit's
JavaScriptCore. The JSC objects all follow Apple's design pattern where C
style API functions return and operate on ref pointer types that must be
destroyed using specific API calls for each type.

It seems like a natural fit with smart pointers, such that record types
could be used to hold onto things such as JSStringRef, JSClassRef,
JSValueRef, and more, retaining and releasing them for you automatically
with the appropriate JSC API when they go out of scope using the smart
pointer Initialize, Finalize, and Copy operators.

e.g. JSClassRetain, JSClassRelease

For those interested, the JSC library works on all platforms and allows for
integrations between native code applications, and a high performance java
scripting engine. The same engine powering webkit browsers. The API allows
you to expose your native code functions as javascript functions or
classes, as well as providing a virtual machine to execute javascript.
Properly confiruged, the javascript can callback your pascal code
optionally passing javascript objects are arguments to your native code.

All of these operations would be much easier to program against with stack
based types (record or object) if smart pointer support was present in FPC.

Finally, with JSC it's quite easy and possible for developers to embed
webkit webview windows in their desktop applications, and optionally grant
any web page the ability invoke free pascal code you decide to expose, and
for free pascal in return invoke arbitrary javascript objects or functions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180429/7ff40e33/attachment.html>

More information about the fpc-devel mailing list