[swift-evolution] [swift-evolution-announce] [Review] SE-0096: Converting dynamicType from a property to an operator

Dave Abrahams dabrahams at apple.com
Wed May 25 13:26:09 CDT 2016

on Tue May 24 2016, Chris Lattner <clattner-AT-apple.com> wrote:

> Hello Swift community,
> The review of "SE-0096: Converting dynamicType from a property to an operator" begins now and runs through May 30. The proposal is available here:
> 	https://github.com/apple/swift-evolution/blob/master/proposals/0096-dynamictype.md
> Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at
> 	https://lists.swift.org/mailman/listinfo/swift-evolution
> or, if you would like to keep your feedback private, directly to the review manager.
> What goes into a review?
> The goal of the review process is to improve the proposal under review
> through constructive criticism and contribute to the direction of
> Swift. When writing your review, here are some questions you might
> want to answer in your review:
> 	* What is your evaluation of the proposal?
> 	* Is the problem being addressed significant enough to warrant a change to Swift?
> 	* Does this proposal fit well with the feel and direction of Swift?
> 	* If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
> 	* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
> More information about the Swift evolution process is available at
> 	https://github.com/apple/swift-evolution/blob/master/process.md
> Thank you,

I don't understand why the proposal says we can't implement this in the
library today.  

  $ swift
  Welcome to Apple Swift version 2.2 (swiftlang-703.0.18.8 clang-703.0.30). Type :help for assistance.
    1> func dynamicType_<T>(_ x: T) -> T.Type { return x.dynamicType }
    2> dynamicType_(42)
  $R0: Int.Type = Int
    3> class B {}
    4. class C : B {}
    5. dynamicType_(C() as B)
  $R1: B.Type = __lldb_expr_5.C

IMO exposing it as a special language feature is a mistake unless
there's something wrong with the implementation above.  There are many
ways we can implement the body of the generic function and still remove
the .dynamicType property from the language's user model.


More information about the swift-evolution mailing list