-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
@JXFunc handles async function signatures that work with classes but not with actors. You can see this by changing TimePod to extend AnyActor, which (after fixing a couple other trivial issues) will fail (with "Generic parameter 'T' could not be inferred") to build the function:
@JXFunc var jxsleep = sleep
public func sleep(duration: TimeInterval) async throws
The reason is that a function reference to a class is (Self)->(Args…)->Result, but an Actor's will be (isolated Self)->(Args…)->Result.
I think this means that every async JXFunc initializer will need to have an additional initializer that accepts Self as isolated, unless some signature massaging can make one of them unnecessary.
public init<P0>(wrappedValue: @escaping (T) -> (P0) async throws -> R) {
functionBridge = { FunctionBridge(name: $0, function: wrappedValue) }
}
public init<P0>(wrappedValue: @escaping (isolated T) -> (P0) async throws -> R) {
// TODO…
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels