on Mon Aug 08 2016, Jacob Bandes-Storch <swift-evolution@swift.org> wrote:

> Hi Dave,
> I just filed https://bugs.swift.org/browse/SR-2303.
>
> Brainstorming: is it important that the init(stringInterpolation:) and
> init(stringInterpolationSegment:) requirements are on the same type?

As far as I'm concerned the design space is wide open.

> Perhaps it would work to separate these two requirements, allowing the
> segments to construct intermediate types, and only requiring the type
> adopting ExpressibleByStringInterpolation to implement
> init(stringInterpolation:).
>
> This would be nice because it would be much easier for types which aren't
> enums to conform to ExpressibleByStringInterpolation. In my auto layout
> example (https://gist.github.com/jtbandes/9c1c25ee4996d2554375), the
> ConstraintCollection type is only an enum because it has to provide all the
> initializers, but it's strange that the cases are accessible publicly;

I'm not sure whether what you're describing is just a limitation in our
access control (a public type conforming to a protocol must expose all
of that protocol's requirements as public members).  If so, maybe we
should fix *that*, rather than morphing designs to work around it.

That said, I don't really have time to think about the design of
ExpressibleByStringInterpolation in detail at the moment, as we're right
up against the Swift 3 ship date (sorry!)  If you'd bring it up in a few
months I'm sure I'll have a lot more bandwidth for it.

Thanks,

-- 
-Dave

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

Reply via email to