[swift-evolution] [Draft] Mixins

Radosław Pietruszewski radexpl at gmail.com
Sat Feb 27 08:00:49 CST 2016

This is compelling to me.

I haven’t put enough thought into it to make up my mind about it, but a mixin system would solve a problem I’m currently struggling with.

I’ve been working on cleaning up the codebase of my iOS/Mac app, and I’m trying to reduce duplication between the codebases. The problem is, there are things that aren’t easy to completely encapsulate into a separate, universal class — things that have bits and pieces in common, but different overall shape.

Perhaps I should encapsulate them anyway, add a level of indirection, inject dependencies… But a mixin is an abstraction that would allow me to extract common parts in an easier way.

— Radek

> On 27 Feb 2016, at 10:59, Антон Жилин via swift-evolution <swift-evolution at swift.org> wrote:
> Some people opposed to Abstract Classes proposal (including myself) have said that mixins could solve the problem better.
> So I prepaired a proposal draft to add stored properties to protocols. Here it is:
> https://gist.github.com/Anton3/f0550922c1be0fc5447c <https://gist.github.com/Anton3/f0550922c1be0fc5447c>
> P.S. I added a `mixin` keyword in the beginning, but we can opt to just extend protocols, which I mention in "alternatives".
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160227/af2de5b0/attachment.html>

More information about the swift-evolution mailing list