Just to display the behavioral difference of print that will come with this proposal in Swift 6:
struct Dog {
let name: String
let age: Int
}
let sparky = Dog(name: "Sparky", age: 2)
// Debug: "Dog(name: "Sparky", age: 2)"
// Release: "Dog()"
print(sparky)
This example isn't quite right because in Swift 6 if a type doesn't conform to Reflectable, reflection metadata emitted for debugging wouldn't be accessible through Nominal Type Descriptor. So it would look like this, even if the debugger has access to reflection metadata:
// Debug: "Dog()"
// Release: "Dog()"
But if you wanted to emphasize the difference between language versions, then yes, it would look like this:
// Swift 5: "Dog(name: "Sparky", age: 2)"
// Swift 6: "Dog()"
I agree with Jordan that the current default behavior may not benefit most developers who just want their apps to be safe and small.
I can't come up with many cases when code like this would be useful for real-life applications.
var dogString = ""
print(sparky, to: &dogString)
In my opinion, the internal state of variables should be used only for debugging, and no logic should depend on it. (I may be wrong, so any examples are welcome)
Types' names are slightly different cases, but they are available without reflection. For instance, In the iOS world API like String(describing:) might be used to register UICollectionViewCell class with runtime, but I don't think that the absence of reflection will break this code.
Those reflection-consuming APIs do not provide any guarantees about their output and make the best effort to do their job. If a developer chooses to depend on their output, they implicitly take risks that the output may change. (More information might be printed, the output may change, etc)
I think the main point here is that some percentage of code might be broken in the short term, but in a long term, developers will gain an opportunity to make sure that this code will never break because of the absence of reflection. And Swift 6 might be the best option to achieve this because developers will need to migrate their codebases to this major version of the language anyway.