You can do this if you don't write '&', which incorporates the caveat that
you're not passing a stable address. But please file a bug anyway, because the
diagnostic should tell you that!
Jordan
> On Jan 16, 2018, at 13:10, Rick Mann via swift-users
> wrote:
>
> Is it
+1
An example I ran in to today:
func dumpKeys(of object: T, _ keypaths: PartialKeyPath...) {
for kp in keypaths {
print("-", "\(kp): \(object[keyPath: kp])")
}
}
Then in LLDB, I want to be able to write:
dumpKeys(of: context, \.invalidateEverything, \.invalidateDataSourceCounts)
But
Is it not possible for Swift to treat C API const pointers as something that
can take let arguments?
LGS_EXPORT bool lgs_notify(struct lgs_context_t* ctx, const
lgs_notify_params_t* params);
.
.
.
let p = lgs_notify_params_t(...)
lgs_notify(self.ctx, )
^Cannot pass
Xcode can't properly parse the C header to show me the Swift signature, but if
I try calling it like this:
let p = lgs_notify_params_t(notify: lgs_notify_did_enter_background)
lgs_notify(self.ctx, p)
I get this error:
Cannot convert value of type 'lgs_notify_params_t' to expected
Oh no, you're right, I'm sorry. You can only do that with arrays at the moment.
We do have a bug for this already.
Jordan
> On Jan 16, 2018, at 16:37, Roderick Mann wrote:
>
> Xcode can't properly parse the C header to show me the Swift signature, but
> if I try
For posterity, I object to the phrasing "Swift arrays are not thread safe". The
problem was that "globals are not (automatically) thread-safe". Arrays are no
less thread safe than class references here.
Jordan
> On Jan 15, 2018, at 13:09, Kenny Leung via swift-users
>