Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WorkerPool cannot have additional protocol conformance #1061

Open
pbk20191 opened this issue Sep 12, 2022 · 4 comments
Open

WorkerPool cannot have additional protocol conformance #1061

pbk20191 opened this issue Sep 12, 2022 · 4 comments
Assignees
Labels
1 - triaged Ticket makes sense and is well defined, ready to be worked on relates-to-swift-feature t:cluster:singleton t:worker-pool
Milestone

Comments

@pbk20191
Copy link

pbk20191 commented Sep 12, 2022

Context:
Just learning about swift-distributed actor and system. I tried to make WorkerPool to adapt ClusterSingleton protocol to use it as single instance.
extension WorkerPool: ClusterSingleton {}

Then Xcode compiler fails with following message:

/Users/pbk/Documents/XcodeWorkSpace/ToyWorkSpace/DemoToycraft/DistributedActors.WorkerPool:3:16: Property 'actorSystem' cannot be defined explicitly, as it conflicts with distributed actor synthesized stored property
/Users/pbk/Documents/XcodeWorkSpace/ToyWorkSpace/DemoToycraft/DistributedActors.WorkerPool:2:16: Property 'id' cannot be defined explicitly, as it conflicts with distributed actor synthesized stored property

Also WorkerPool cannot conform to empty protocol.

protocol EmptyProtocol {}
extension WorkerPool: EmptyProtocol {}

Commit hash: 811d2e8 ( 1.0.0-beta.2 )

Environment:

IDE and tool chain : Xcode 14.0 RC, Xcode 14 RC tool chain
My application targets iOS 16.0 iphone 8 simulator
$ swift --version
swift-driver version: 1.45.2 Apple Swift version 5.6.1 (swiftlang-5.6.0.323.66 clang-1316.0.20.12)
Target: x86_64-apple-macosx12.0

Operating system: macOS Monterey 12.5.1

$ uname -a
Darwin iquest1127ui-MacBookPro.local 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64 x86_64

My system has IPv6 enabled.

@pbk20191 pbk20191 reopened this Sep 12, 2022
@ktoso ktoso self-assigned this Sep 12, 2022
@ktoso ktoso added the 1 - triaged Ticket makes sense and is well defined, ready to be worked on label Sep 12, 2022
@ktoso ktoso added this to the 1.0.x milestone Sep 12, 2022
@ktoso
Copy link
Member

ktoso commented Sep 12, 2022

Hmm, thanks for the report, I wonder if that's a language issue actually... Will look into it soon.

@ktoso
Copy link
Member

ktoso commented Sep 12, 2022

Having that said, it is a bit weird to make a worker pool a singleton -- are you sure that's what you'd need? usually you'd reach for one or the other.

@pbk20191
Copy link
Author

Having that said, it is a bit weird to make a worker pool a singleton -- are you sure that's what you'd need? usually you'd reach for one or the other.

I thought it would be appropriate to have one Worker Pool instance per WorkerPoolSetting.Selector in actorSystem, so I tried the above approach. I don't have specific goal or need for this. Just working around learning new features of swift 5.7.

If you can afford it, could you explain why it's weird or where the reference or url about it?

@pbk20191
Copy link
Author

pbk20191 commented Sep 12, 2022

I guess this issue is not related to singleton. WorkerPool can't adapt any additional protocol.
This two line of code is enough for compiler to fail.

protocol EmptyProtocol {}
extension WorkerPool: EmptyProtocol {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - triaged Ticket makes sense and is well defined, ready to be worked on relates-to-swift-feature t:cluster:singleton t:worker-pool
Projects
None yet
Development

No branches or pull requests

2 participants