[swift-evolution] [Pitch] Rename Mirror
antonyzhilin at gmail.com
Thu Jul 21 17:25:46 CDT 2016
- Proposal: SE-NNNN <http://NNNN-filename.md>
- Author: Anton Zhilin <https://github.com/Anton3>, Adrian Zubarev
- Status: *Awaiting review*
- Review manager: TBD
Rename Mirror to DebugRepresentation and CustomReflectable to
Name of Mirror does not reflect (no pun) what it is intended to do, i.e.
providing full featured reflection, which we want to see in Swift 4. Other
than that, it is only intended to serve for debugging purposes, e.g.
building trees for selected objects. Some evidence to that:
- Mirror.DisplayStyle contains optional and set as special cases, but
does not contain function
- Mirror collects all information possible at initialization, while for
true reflection we want laziness
- Mirror allows customization. For example, Array<T> is represented with
a field for each of its elements. Do we want this for “true” reflection we
want to add in the future?
- Rename struct Mirror to DebugRepresentation
- Rename protocol CustomReflectable to CustomDebugRepresentable
- Rename property customMirror to customDebugRepresentation
- Hope that one day we will get a real Mirror with full reflection
Impact on existing code
This is a breaking change; easy automated migration possible.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution