ikesyo / Himotoki

A type-safe JSON decoding library purely written in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DecodedType is removable at Swift 2.1

tarunon opened this issue · comments

Swift2.1 function is returnable Self type in class, so I think we don't need DecodedType now.

public protocol Decodable {
    /// - Throws: DecodeError
    static func decode(e: Extractor) throws -> Self
}

That is destructive change, but it has some advantages.

  1. as Decodable.
    Now we cannot cast any value to Decodable because it has associated type.
    If it remove Decodable, we will able to do it.
  2. Support subclass.(restrict)
    Himotoki don't support subclass now, because DecodedType bounds base class.
    But swift don't support override extensions function, the merit will be restrict.
  3. Integration operators.(Array, Dictionary, Optional.)
    If you aspect runtime check.

Closing this since this is implemented in #100 and I've just released 2.0.0-beta.1. 😉