Re: Protocol extensions returning self
Re: Protocol extensions returning self
- Subject: Re: Protocol extensions returning self
- From: Quincey Morris <email@hidden>
- Date: Thu, 04 Feb 2016 10:18:53 -0800
- Feedback-id: 167118m:167118agrif8a:167118sbpr4VXYUm:SMTPCORP
On Feb 4, 2016, at 05:03 , Charles Jenkins <email@hidden> wrote:
>
> am I tilting at a windmill?
The problem is that the protocol in unspecific as to what kind of types it can be applied to, and your intentions don’t work if the type is a struct**. In fact, you only apply it to classes (Fluent.Sequence and Fluent.Group). So, you can fix the errors by saying that it’s a class-only protocol:
> protocol SKActionCollection: class {
and eliminating the ‘mutating’ keywords.
** Because structs constructed in a expression are literals and can’t be mutated even if they have mutating methods. That why ‘(a + a)++’ doesn’t compile, even if ‘a’ is a mutable variable.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden