Swift: Oh, so that’s what MembershipContainer was

jar-4-1424279-m

I was updating my exploration utilities today. As I was going along, I reviewed the mirror disposition enumerations. There’s index container (Array) and key container (Dictionary). I was noodling along past Membership Container when I suddenly thought, “Hey, isn’t that a Set?”

Sure enough it was. This enumeration has been there pretty much forever, by the way because this source file dates back to June of last year.

reflect(Set<Int>()).disposition == .MembershipContainer // returns true

I’m still unsure what the unlabeled “Container” container and “Aggregate” are. Any ideas?

func DispositionString(disposition : MirrorDisposition) -> String {
    switch disposition {
    case .Aggregate: return "Aggregate"
    case .Class: return "Class"
    case .Container: return "Container"
    case .Enum: return "Enum"
    case .IndexContainer : return "Index Container (Array)"
    case .KeyContainer : return "Key Container (Dict)"
    case .MembershipContainer : return "Membership Container (Set)"
    case .Optional : return "Optional"
    case .Struct: return "Struct"
    case .Tuple: return "Tuple"
    case .ObjCObject: return "ObjC Object"
    }
}

Well, I know for sure as anything it isn’t this.

Update: hmm

Screen Shot 2015-04-29 at 11.47.45

Comments are closed.