https://github.com/Anton3/swift-evolution/blob/master/proposals/NNNN-rename-mirror.md
Rename Mirror

   - Proposal: SE-NNNN <http://NNNN-filename.md>
   - Author: Anton Zhilin <https://github.com/Anton3>, Adrian Zubarev
   <https://github.com/DevAndArtist>
   - Status: *Awaiting review*
   - Review manager: TBD

Introduction

Rename Mirror to DebugRepresentation and CustomReflectable to
CustomDebugRepresentable.
Motivation

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?

Proposed solution

   - 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
   capabilities

Impact on existing code

This is a breaking change; easy automated migration possible.
​
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to