   }
 }
 
-fileprivate protocol KeyValueStringFormatterValueHandler {
+fileprivate protocol KeyValueStringFormatterValueHandler: class {
+  // Swift 3: Cannot nest protocols in classes, hence outside of the class
+  // - if that isn't a class protocol, swiftc 3.1.1 crashes on Linux
+  
   var lastKeyWasMiss : Bool { get }
 
   /**

   * @param _key - the key to resolve, or null
   * @return the value stored under the key, or the next value from an array
   */
  mutating func value(forKey: String) -> Any?
}

     * - 'length', 'size', 'count'
     * - an Integer is parsed as an index, eg %(2)s => array[2]
     */
    func value(forKey key: String) -> Any? {
      if key.isEmpty {
        guard cursor < array.count else {
          lastKeyWasMiss = true
