about protocols

Hi.
I was thinking about a simple way of implementing the handling of
dependencies in swift and arrived to the following solution, however,
currently it isn't supported in swift. Can we get a way of making this work?

dependencies-using-static-members-in-protocol-in-swift

A static method or property on a protocol already means something separate - that the types which implement that protocol that static method/property.

I’d recommend moving your factory method to another type or a global function?

-DW

···

On Nov 15, 2016, at 10:10 AM, Reynaldo Aguilar Casajuana via swift-evolution <swift-evolution@swift.org> wrote:

Hi.
I was thinking about a simple way of implementing the handling of dependencies in swift and arrived to the following solution, however, currently it isn't supported in swift. Can we get a way of making this work?

Getting dependencies using static members in protocol in Swift? - Stack Overflow

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Yes, that would be a classic factory method.
However, what I want is to take advantage of the power of protocol
extensions and use them for improving the way in which dependencies are
resolved in most classic programming languages. The current meaning of
static method/property in protocols, how much useful is it? I even think
that it is a bit ugly to let the user to add a static property directly to
a protocol via an extension, and don't let the user use that static
property via the protocol.

···

On Tue, Nov 15, 2016 at 1:38 PM, David Waite <david@alkaline-solutions.com> wrote:

A static method or property on a protocol already means something separate
- that the types which implement that protocol that static method/property.

I’d recommend moving your factory method to another type or a global
function?

-DW

On Nov 15, 2016, at 10:10 AM, Reynaldo Aguilar Casajuana via > swift-evolution <swift-evolution@swift.org> wrote:

Hi.
I was thinking about a simple way of implementing the handling of
dependencies in swift and arrived to the following solution, however,
currently it isn't supported in swift. Can we get a way of making this work?

Getting dependencies using static members in protocol in Swift? - Stack Overflow
cies-using-static-members-in-protocol-in-swift

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution