I want to thank you for your "rubber duck" consultancy; I now have a working
factory mechanism…
protocol PropertyFactory { }
extension PropertyFactory
{
static func createProperty() -> PropertyProtocol
{
typealias ValueType = Self
return Property<ValueType>()
}
}
extension Int : PropertyFactory { }
The key was to typealias Self so that it could then be passed as a type
parameter to the generic type.
The problem remains that it is still necessary to implement PropertyFactory on
each and every type that is likely to be used for a property.
I would therefore ask if anything that would make life simpler in this regard
is a worthwhile candidate for inclusion in the future of Swift?
Joanna
--
Joanna Carter
Carter Consulting
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution