     return "A\(UInt(bitPattern: Unmanaged.passUnretained(object).toOpaque().hashValue))B"
 }
 
-public struct VFLComponent: ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral, ExpressibleByFloatLiteral, ExpressibleByIntegerLiteral {
+public struct VFLComponent {
     public var format = ""
-    
-    // ExpressibleByArrayLiteral
-    var viewDict = [String: UIView]()
+    var viewMap = NSMapTable<NSString, UIView>(keyOptions: .copyIn, valueOptions: .weakMemory)
+    var metricMap = NSMapTable<NSString, NSNumber>(keyOptions: .copyIn, valueOptions: [.copyIn, .objectPointerPersonality])
+}
+
+extension VFLComponent: ExpressibleByArrayLiteral {
     public typealias Element = UIView
     public init(arrayLiteral elements: Element...) {
         guard elements.count == 1 else {
             fatalError("view component can contains only one UIView instance: \(elements)")
         }
         let view = elements[0]
-        let key = vflKey(view)
-        viewDict[key] = view
+        let key = vflKey(view) as NSString
+        viewMap.setObject(view, forKey: key)
         self.format = "[\(key)]"
     }
-    
-    // ExpressibleByDictionaryLiteral
+}
+
+extension VFLComponent: ExpressibleByDictionaryLiteral {
     public typealias Key = UIView
     public typealias Value = VFLComponent
     public init(dictionaryLiteral elements: (Key, Value)...) {

        }
        let view = elements[0].0
        let numbers = elements[0].1
        let key = vflKey(view)
        viewDict[key] = view
        metricDict = numbers.metricDict
        if numbers.isWrapped {
            self.format = "[\(key)\(numbers.format)]"
        } else {
            self.format = "[\(key)(\(numbers.format))]"
        }
    }
    
    // ExpressibleByFloatLiteral, ExpressibleByIntegerLiteral
    var metricDict = [String: NSNumber]()
    public typealias FloatLiteralType = Double
    public init(floatLiteral value: FloatLiteralType) {
        let number = value as NSNumber
        let key = vflKey(number)
        metricDict[key] = number
        self.format = key
    }
    public typealias IntegerLiteralType = Int
    public init(integerLiteral value: IntegerLiteralType) {
        let number = value as NSNumber
        let key = vflKey(number)
        metricDict[vflKey(number)] = number
        self.format = key
    }
    
}

private extension VFLComponent {
    var isWrapped: Bool {
        return self.format.hasPrefix("(") && self.format.hasSuffix(")")
    }
}

// MARK: - operators


public func -(lhs: VFLComponent, rhs: VFLComponent) -> VFLComponent {
    var result = lhs
    result.format = lhs.format + "-" + rhs.format
    for key in rhs.viewMap.keyEnumerator().allObjects {
        let key = key as! NSString
        let view = rhs.viewMap.object(forKey: key)
        result.viewMap.setObject(view, forKey: key)
    }
    for key in rhs.metricMap.keyEnumerator().allObjects {
        let key = key as! NSString
        let number = rhs.metricMap.object(forKey: key)
        result.metricMap.setObject(number, forKey: key)
    }
    return result
}
