on Fri May 20 2016, Adrian Zubarev <[email protected]> wrote:
> I’d like to discuss with the community to see their reactions on that topic. > > Basically from the beginning of Swift I thought it was just confusing how > these typealiases were used and named. > As we know from Apply API Guidelines to the Standard Library the Type suffix > will be dropped. > > Currently we also discuss about the `Any<…>` existential which may > contain Any-type requirement one day (by ’type’ I mean `class`, > `struct`, `enum` in a way like this: `Any<class>`). > > The Any-class requirement could replace the current `AnyObject` > protocol with a typealias like this: `typealias AnyObject = > Any<class>` > > Assume Swift would introduce Any-struct and Any-enum requirement one > day. How would one name a typealias for these, where `AnyClass` means > `AnyObject.Type`? > > I suggest we drop the current `AnyClass` and rename `AnyObject` to > `AnyClass`. If one would need the old `AnyClass` behavior it will > become `AnyClass.Type`. > > In the future we could have typealiases like this, which are more clear: > > `typealias AnyClass = Any<class>` > `typealias AnyStruct = Any<struct>` > `typealias AnyEnum = Any<enum>` I would oppose this, since the distinction between AnyStruct and AnyEnum is not a useful one. There's no observable semantic difference between a struct that conforms to a protocol P and an enum that conforms to the same protocol. > I don’t know how the migration process works but I can assume that this > should be done in the right order: > > - migrate every `AnyClass` to `AnyClass.Type` > - at the end migrate `AnyObject` to `AnyClass` > > What do you think? I’d write a small proposal if the community reaction is > positive. > > -- > Adrian Zubarev > Sent with Airmail > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution -- -Dave _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
