Re: [swift-users] Strange type error

2016-03-25 Thread zhigang via swift-users
It might have something to do with `setSubscriptee` with seems from the implementation is a `mutating` operation. If you comment it out, or just give it a empty callback, it will pass compile. Kyle On Tue, Mar 22, 2016 at 6:23 AM Howard Lovatt via swift-users < swift-users@swift.org> wrote:

Re: [swift-users] Strange type error

2016-03-25 Thread zhigang via swift-users
You can not mutate a array itself in a `var asScriptable` you might be able to accomplish such with a function. struct AllSubscriptable { let setSubscriptee: (index: Index, element: E) -> Void } extension Array { mutating func asScriptable() -> AllSubscriptable { func sub(key:In

Re: [swift-users] Strange type error

2016-03-21 Thread Howard Lovatt via swift-users
Hi, I don't understand your comment, can you explain some more please? Thanks, -- Howard. On Monday, 21 March 2016, zh ao wrote: > You protocol is not defined properly. > > On Mon, Mar 21, 2016 at 7:08 AM, Howard Lovatt via swift-users < > swift-users@swift.org > > wrote: > >> HI, >> >> Does

[swift-users] Strange type error

2016-03-20 Thread Howard Lovatt via swift-users
HI, Does anyone know what is happening here: protocol Subscriptable { associatedtype Element associatedtype Index var firstIndex: Index { get } var lastIndex: Index { get } subscript(index: Index) -> Element { get set } } struct AllSubscriptable: Subscriptable { t