> On Jun 17, 2016, at 1:12 AM, Brent Royal-Gordon <br...@architechies.com> > wrote: > >> - func descriptionWithDefaultValue(_ defaultValue: String = "nil") -> >> String - which would return either the description of the value, or >> `defaultValue`. > > This is the same as myOptional?.description ?? defaultValue, isn't it? So do > we need it?
We need it because: - myOptional doesn't necessarily need to contain a CustomStringConvertible, hence .description might not be defined on it (enums, structs, pure Swift classes, ...). - I have originally suggested making Optional CustomStringConvertible so that .description would return the same value as descriptionWithDefaultValue() (and hence just myOptional.description would be sufficient) and .debugDescription would keep its current behavior. But it was pointed out to me that invoking debugDescription and description is explicitly discouraged from in the documentation and that it's not a correct solution. See updated proposal on https://gist.github.com/charlieMonroe/82e1519dd2b57029f69bc7abe99d7385 > > -- > Brent Royal-Gordon > Architechies > _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution